Last active
March 25, 2025 12:03
-
-
Save aioue/d17caea5d49e0905363d4b78221b86c4 to your computer and use it in GitHub Desktop.
Guacamole Docker Compose with MariaDB, TOTP, and Healthchecks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tested with 1.5.1 guacamole release and latest (2025-02-20) from Apache's Dockerhub (https://hub.docker.com/u/guacamole) | |
# To use this, start *only* the guacdb service first, copy and inject the guacamole initdb.sql script, then bring up the remaining services. | |
# Source: https://krdesigns.com/articles/how-to-install-guacamole-using-docker-step-by-step | |
version: '3.1' | |
services: | |
guacdb: | |
container_name: guacdb | |
image: mariadb:lts | |
restart: unless-stopped | |
environment: | |
MYSQL_ROOT_PASSWORD: "{{ MySqlDbRootPass }}" | |
MYSQL_DATABASE: "{{ MySqlDbName }}" | |
MYSQL_USER: "{{ MySqlDbUserName }}" | |
MYSQL_PASSWORD: "{{ MySqlDbUserPass }}" | |
volumes: | |
- './db-data:/var/lib/mysql' | |
healthcheck: | |
# Healthceck is MariaDB specific | |
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] | |
start_period: 20s | |
interval: 10s | |
timeout: 5s | |
retries: 3 | |
guacd: | |
container_name: guacd | |
image: guacamole/guacd:{{ guacamole_release_tag }} | |
restart: unless-stopped | |
healthcheck: | |
test: ["CMD-SHELL", "nc -z 127.0.0.1 4822 || exit 1"] | |
start_period: 30s | |
interval: 10s | |
timeout: 5s | |
retries: 3 | |
guacamole: | |
container_name: guacamole | |
image: guacamole/guacamole:{{ guacamole_release_tag }} | |
restart: unless-stopped | |
ports: | |
- 8080:8080 | |
environment: | |
GUACD_HOSTNAME: "guacd" | |
MYSQL_HOSTNAME: "guacdb" | |
MYSQL_DATABASE: "{{ MySqlDbName }}" | |
MYSQL_USER: "{{ MySqlDbUserName }}" | |
MYSQL_PASSWORD: "{{ MySqlDbUserPass }}" | |
TOTP_ENABLED: "true" | |
depends_on: | |
- guacdb | |
- guacd | |
healthcheck: | |
# make a check here as compose removes the inbuilt check on subsequent deploys | |
test: ["CMD-SHELL", "curl --fail http://127.0.0.1:8080/guacamole || exit 1"] | |
start_period: 30s | |
interval: 20s | |
timeout: 10s | |
retries: 3 | |
# volumes: | |
# db-data: | |
# ⬆️ Unused docker 'named volumes' config. (See gist comments). |
Thanks for this gist and healthcheck! Also, because volume defined in lines 16-17 is a directory mount, lines 58-59 aren't needed as those refer to docker volumes and aren't used in the compose file itself. If you remove
./
on line 17, then it would be used.
Thank you for the feedback! I have commented out the "Named Volumes" lines as you recommend, but left them in, so your comment can be read in context.
For people learning Docker; with the ./
left in, line 17
is using "Host Path Mounts", also called "Directory Mounts".
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this gist and healthcheck! Also, because volume defined in lines 16-17 is a directory mount, lines 58-59 aren't needed as those refer to docker volumes and aren't used in the compose file itself. If you remove
./
on line 17, then it would be used.