Setting a password in a Docker container

423 views
Skip to first unread message

Danie van der Merwe

unread,
Jun 16, 2022, 10:06:45 AM6/16/22
to Glances Users
Hi, hope someone can help me with this as I started out with the two methods shown at https://glances.readthedocs.io/en/develop/docker.html but both are giving me problems.

My container is created within Portainer using a docker-compose script file. That worked fine and Glances is running. I had created a map for the volume for the config file, and it created/copied the config file as expected. I made a change in the config file to also display stopped containers, so I know that the config file is working.

But coming back to the suggested ways of setting a password for the browser view:

1. Entering the container console with 'docker exec -it glances_docker sh' does work but trying to start glances as suggested gives unknown command, so I managed to start it instead with '/usr/bin/python3 -m glances -C /glances/conf/glances.conf -w --password' and this does work and gives me the prompt for password, but after entering and saying Yes to save, it runs and then stops (without dropping back to the prompt) with an error 'OSError: [Errno 98] Address in use'. I'm suspecting maybe because Glances is already running in the container?

2. So I tried method two by stating the password in the config file too. But no matter how I set it there ie. just default, or with localhost, and then restarting the container, the browser access never prompts for a password.

I did manage a third way, and that was to edit container setup to add the --password to the -w Environment setting, and restart the container. That too has the effect of starting the container with the password prompt, but the problem is I can see that prompt in the container log, but I can't interact with it to type in the password. Trying to open the container console, says that it cannot open as the container has not finished starting yet.
Reply all
Reply to author
Forward
0 new messages