abesnier / docker-guacamole

A self-contained guacamole docker container for x64. Remotely connect over SSH, RDP or VNC using HTML5.
https://hub.docker.com/r/abesnier/guacamole
GNU General Public License v3.0
78 stars 14 forks source link

How to AutoStart at boot - Restart Flag for .yml file? #12

Closed NaXal closed 1 year ago

NaXal commented 1 year ago

Hello,

I am using docker / docker compose with the suggested .yml file under an Ubuntu 22 Server VM to remote access my local machines via external connection.

All good with the default configuration given here for docker compose yml file. It is working fine and I am able to remote into my local machines (Win RDP or SSH) flawlessly.

However, with the default configuration, this docker container will not start at boot. So, incase the VM or machine hosting this container reboots, I have to manually access the machine from local network to run docker compose up -d to start the container again.

I believe restart: unless-stopped flag / argument is to allow the container to auto-start at boot but I am unable to add that line into the docker compose file since no matter where-ever I am adding it, docker compose up -d is generating error.

Can someone help me make this .yml file automatically start at boot?

Thanks.

abesnier commented 1 year ago

Hi,

Normally, restart: always means that the Docker daemon will start the container at start-up. See Docker documentation. So the error must be somewhere else.

Check that the indentation is correct:restartmust be aligned with image, container_name, environment, etc..., one level below guacamole. Make sure you don't have tabs mixed with spaces.

What is the error message you get when running docker compose up -d?

Cheers

NaXal commented 1 year ago

Hello,

Thank you for your reply.

You are right, I think the error is related to wrong placement of restart argument line.

Can you please help me by telling me where exactly I place this line -> "restart: always"

Below is the YML file, now exactly where do I add it.

version: "3"

services:

guacamole:

image: abesnier/guacamole

container_name: guacamole

volumes:

  - postgres:/config

ports:

  - 8080:8080

volumes:

postgres:

driver: local`

Thanks.

abesnier commented 1 year ago

it will go at the same level as image and container_name.

For info, here's the docker-compose I use (I don't even write anything for postgres, as it is fully enclosed inside the image/container.

version: '3'
services:
    guacamole:
        image: abesnier/guacamole:latest
        restart: always
        container_name: guacamole
        user: root
        environment:
            - TZ=Europe/Paris
            - EXTENSIONS=auth-totp, history-recording-storage
            - GUACD_LOG_LEVEL=info
        volumes:
            - "/srv/docker-www/guacamole/config:/config"
        ports:
            - "8080:8080"
          
NaXal commented 1 year ago

Hello,

Thanks for the help.

Yes, placing in that location & format is now starting the container and service at boot.

I don't even write anything for postgres, as it is fully enclosed inside the image/container.

Sir, I didn't write it myself, I followed your project website to simply copy paste it -> https://hub.docker.com/r/abesnier/guacamole

However it seems you may have updated it to this new format. I will delete the old container and redo it with this new YML format

Thanks a lot for helping me out.

abesnier commented 1 year ago

Dang! you're right! It was in the original repo I forked, and I've never noticed it! I'll fix it right away! EDIT: done!

Glad that it works

Cheers