Deploy Guacamole in a container with Docker and docker-compose

In this tutorial, I will explain how to deploy Guacamole in a container using Docker and docker-compose.

In my first Guacamole tutorial available here, I explained how to install Guacamole directly on Ubuntu.

As you will see, deploying Guacamole in a container is very simple and fast. Maintaining the application is also easier, especially for updates, because the container images already contain the various extensions and plugins.

To get started you need a Linux (Ubuntu) server with Docker and docker-compose installed, here you can find a tutorial that explains step by step.

If you regularly read my tutorials on Docker and containers, you know by now that I am used to working in the /containers folder on my Ubuntu environments.

Start by creating a folder that will contain the different files and folders for our Guacamole environment.

sudo mkdir guacamole

In the guacamole folder, create the docker-compose.yml file.

sudo touch docker-compose.yml

Now open the docker-compose.yml file for the editor:

sudo nano docker-compose.yml

Here is the content of the docker-compose.yml file, adapt it to your environment and change the passwords of the MYSQL accounts.

You can also use the files from the following repository: https://git.rdr-it.io/docker/guacamole. Once cloned, edit the .env file

Download the images and start the containers:

sudo docker-compose pull && sudo docker-compose up -d

Now we need to initialize the MySQL database.

Switch to root:

sudo su

Retrieve the database initialization script:

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

Inject the database file:

docker exec -i guacamole_db mysql --user guacamole --password=change-me guacamole_db < initdb.sql

La commande doit être adapter à votre environnement

Once the containers are started, you can follow the tutorial found here : https://rdr-it.com/en/guacamole-manage-access-to-your-it-environment/.

Using containers saves a lot of time in deploying Guacamole but also saves time for updates.

To update, simply use these command lines:

sudo docker-compose pull && sudo docker-compose up -d



Leave a Comment