Guacamole docker compose: Difference between revisions

From wiki karavi
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
Create a folder that will contain the different files and folders for our Guacamole environment…
mkdir guacamole


Create a folder for the project
In the “guacamole” folder, create the “docker-compose.yml” file…
  mkdir ${HOME}/docker-stack
  touch docker-compose-yml
cd ${HOME}/docker-stack


Initialize the database
Now open “docker-compose.yml” for editing…
mkdir -p ${HOME}/docker-stack/guacamole/init
  nano docker-compose.yml
chmod -R +x ${HOME}/docker-stack/guacamole/init
  docker run --rm guacamole/guacamole:1.5.3 /opt/guacamole/bin/initdb.sh --postgresql > ${HOME}/docker-stack/guacamole/init/initdb.sql


Here is the content of the “docker-compose.yml” file, adapt it to your environment…
version: '3.8'
services:
    guacamole_db:
        container_name: guacamole_db
        hostname: guacamole_db
        image: mariadb:10.11
        restart: always
        volumes:
            - ./guacamole_db:/var/lib/mysql
        environment:
            - MYSQL_ROOT_PASSWORD=blablalinux
            - MYSQL_DATABASE=guacamole_db
            - MYSQL_USER=anyblabla
            - MYSQL_PASSWORD=blabla
        expose:
            - 3306
    guacd:
        container_name: guacd
        hostname: guacd
        image: guacamole/guacd:latest
        restart: always
        volumes:
            - ./guacd_drive:/drive:rw
            - ./guacd_record:/record:rw
        expose:
            - 4822
    guacamole:
        container_name: guacamole
        hostname: guacamole
        restart: always
        image: guacamole/guacamole:latest
        depends_on:
            - guacamole_db
            - guacd
        ports:
            - 8080:8080
        links:
            - guacd
        environment:
            - GUACD_HOSTNAME=guacd
            - MYSQL_HOSTNAME=guacamole_db
            - MYSQL_DATABASE=guacamole_db
            - MYSQL_USER=anyblabla
            - MYSQL_PASSWORD=blabla
            - REMOTE_IP_VALVE_ENABLED=true
In “environment” of the “guacamole_db” service…
Don't forget to customize the “root” password for MySQL…
- MYSQL_ROOT_PASSWORD=blablalinux
Don't forget to customize the username for MySQL…
- MYSQL_USER=anyblabla
Don't forget to customize the password for MySQL…
- MYSQL_PASSWORD=blabla
The “environment” information of the “guacamole_db” service must be the same as the “environment” information of the “guacamole” service!
The variable “- REMOTE_IP_VALVE_ENABLED=” must be activated if you are using a reverse proxy …
- REMOTE_IP_VALVE_ENABLED=true
To enable two-factor authentication , simply add this variable below the variable “- REMOTE_IP_VALVE_ENABLED=true”…


Create the ${HOME}/docker-stack/guacamole/docker-compose.yml file:
  - TOTP_ENABLED=true
  nano ${HOME}/docker-stack/guacamole/docker-compose.yml


Paste the following content into it :


version: '3.9'
The default username and password is: guacadmin
 
# networks
 
# create a network 'guacamole_net' in mode 'bridged'
You can start the container!
  networks:
  docker-compose up -d
  guacamole_net:
 
    driver: bridge
 
  haproxy_net:
 
    external: true
Manual/Portainer - Common Instructions
  sudo su
  # services
  docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --mysql > initdb.sql
  services:
docker exec -i guacamole_db mysql --user anyblabla --password=blabla guacamole_db < initdb.sql
  # guacd
 
  guacd:
The order must be adapted to your environment…
    container_name: guacamole_backend
--user anyblabla --password=blabla
    image: guacamole/guacd:1.5.3
    networks:
      guacamole_net:
    restart: always
    volumes:
    - ./drive:/drive:rw
    - ./record:/var/lib/guacamole/recordings:rw
  # postgres
  postgres:
    container_name: guacamole_database
    environment:
      PGDATA: /var/lib/postgresql/data/guacamole
      POSTGRES_DB: guacamole_db
      POSTGRES_PASSWORD: '${POSTGRES_PASSWORD}'
      POSTGRES_USER: '${POSTGRES_USER}'
    image: postgres:15.0
    networks:
      guacamole_net:
    restart: always
    volumes:
    - ./init:/docker-entrypoint-initdb.d:ro
    - ./data:/var/lib/postgresql/data:rw
   
  # guacamole
  guacamole:
    container_name: guacamole_frontend
    depends_on:
    - guacd
    - postgres
    environment:
      GUACD_HOSTNAME: guacd
      POSTGRESQL_DATABASE: guacamole_db
      POSTGRESQL_HOSTNAME: postgres
      POSTGRESQL_PASSWORD: '${POSTGRES_PASSWORD}'
      POSTGRESQL_USER: '${POSTGRES_USER}'
      POSTGRESQL_AUTO_CREATE_ACCOUNTS: true
    image: guacamole/guacamole:1.5.3
    links:
    - guacd
    networks:
      - guacamole_net
      - haproxy_net
    restart: always
    volumes:
    - ./drive:/drive:rw
    - ./record:/var/lib/guacamole/recordings

Latest revision as of 19:12, 30 March 2025

Create a folder that will contain the different files and folders for our Guacamole environment…

mkdir guacamole

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

touch docker-compose-yml

Now open “docker-compose.yml” for editing…

nano docker-compose.yml

Here is the content of the “docker-compose.yml” file, adapt it to your environment…

version: '3.8'

services:
    guacamole_db:
        container_name: guacamole_db
        hostname: guacamole_db
        image: mariadb:10.11
        restart: always
        volumes:
            - ./guacamole_db:/var/lib/mysql
        environment:
            - MYSQL_ROOT_PASSWORD=blablalinux
            - MYSQL_DATABASE=guacamole_db
            - MYSQL_USER=anyblabla
            - MYSQL_PASSWORD=blabla
        expose:
            - 3306

    guacd:
        container_name: guacd
        hostname: guacd
        image: guacamole/guacd:latest
        restart: always
        volumes:
            - ./guacd_drive:/drive:rw
            - ./guacd_record:/record:rw
        expose:
            - 4822

    guacamole:
        container_name: guacamole
        hostname: guacamole
        restart: always
        image: guacamole/guacamole:latest
        depends_on:
            - guacamole_db
            - guacd
        ports:
            - 8080:8080
        links:
            - guacd
        environment:
            - GUACD_HOSTNAME=guacd
            - MYSQL_HOSTNAME=guacamole_db
            - MYSQL_DATABASE=guacamole_db
            - MYSQL_USER=anyblabla
            - MYSQL_PASSWORD=blabla
            - REMOTE_IP_VALVE_ENABLED=true


In “environment” of the “guacamole_db” service…

Don't forget to customize the “root” password for MySQL…

- MYSQL_ROOT_PASSWORD=blablalinux

Don't forget to customize the username for MySQL…

- MYSQL_USER=anyblabla

Don't forget to customize the password for MySQL…

- MYSQL_PASSWORD=blabla

The “environment” information of the “guacamole_db” service must be the same as the “environment” information of the “guacamole” service!


The variable “- REMOTE_IP_VALVE_ENABLED=” must be activated if you are using a reverse proxy …

- REMOTE_IP_VALVE_ENABLED=true

To enable two-factor authentication , simply add this variable below the variable “- REMOTE_IP_VALVE_ENABLED=true”…

- TOTP_ENABLED=true


The default username and password is: guacadmin


You can start the container!

docker-compose up -d


Manual/Portainer - Common Instructions

sudo su
docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --mysql > initdb.sql
docker exec -i guacamole_db mysql --user anyblabla --password=blabla guacamole_db < initdb.sql

The order must be adapted to your environment…

--user anyblabla --password=blabla