Install Official Guacamole on Docker

by RamWise
Published: Last Updated on 1,101 views

Guacamole is a clientless remote desktop gateway for VNC, RDP, and SSH protocols. Using this you can connect to any of your computers via a web browser. It can be installed as a standalone application or as a docker image. Docker installation is the easiest to install and maintain.

Here we shall see how to install Guacamole as a docker container and connect to a remote machine quickly.

Installing Guacamole Docker container

1. On Portainer, add a new stack with name Guacamole. Leave the Build method as Web Editor.

2. Copy the below compose file content into the Web editor. You can customize if needed and deploy.

version: "2"
services:
  db:
    image: mariadb
    restart: unless-stopped
    container_name: mariadb
    environment:
      - MYSQL_ROOT_PASSWORD=rootpw
      - MYSQL_DATABASE=guacamole_db
      - MYSQL_USER=guacamole_user
      - MYSQL_PASSWORD=guacamolepw
    volumes:
      - /opt/container/mariadb:/var/lib/mysql
    ports:
      - 3306:3306
    hostname: mariadb
    networks:
      - intranet

  guacd:
    image: guacamole/guacd
    container_name: guacd
    hostname: guacd
    restart: always
    volumes:
      - /opt/container/guacamole/guacd:/etc/guacamole
    ports:
      - 4822:4822
    networks:
      - intranet

  guacamole:
    image: guacamole/guacamole
    container_name: guacamole
    hostname: guacamole
    restart: always
    volumes:
      - /opt/container/guacamole/guacamole:/etc/guacamole
    ports:
      - 3080:8080
    environment:
      - GUACD_HOSTNAME=guacd
      - GUACD_PORT=4822
      - MYSQL_HOSTNAME=mariadb
      - MYSQL_PORT=3306
      - MYSQL_DATABASE=guacamole_db
      - MYSQL_USER=guacamole_user
      - MYSQL_PASSWORD=guacamolepw
      - GUACAMOLE_HOME=/data
    networks:
      - intranet

networks:
  intranet:
    external:
      name: intranet 

3. Guacamole needs the tables configured in the MariaDB docker container to work. The below to commands accomplish that. After running the above commands, make sure to restart all three containers.

docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --mysql > initdb.sql

docker exec -i mariadb mysql -u root --password=rootpw guacamole_db  < initdb.sql 

4. Then, go to http://localhost:8080/guacamole/ and login with default credentials guacadmin:guacadmin. Now you have successfully installed Guacamole on docker.

Guacamole Docker install Featured Image

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More