-
Notifications
You must be signed in to change notification settings - Fork 35
Description
- Nico640/docker-unms 2.4.188
- WSL2 2.4.12.0 (latest:
wsl --update --web-download) - Ubuntu 24.04 (latest
sudo apt-get update && sudo apt-get upgrade -y - Docker version 28.0.1, build 068a01e
Error in unms-uisp container logs:
"Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only"
RabbitMQ restarts over and over.
Exec'ing into the container docker exec -it unms-usip /bin/bash and chmod 700 /var/lib/rabbitmq/.erlang.cookie does not result in any change to the permissions on the cookie file. That file still shows node:node 777 as the ownership and permissions.
rm /var/lib/rabbitmq/.erlang.cookie was successful, but same behavior / error over and over when I restart the container.
Looking at your Dockerfile, I can see that /var/lib/rabbitmq is being created without permissions explicitly set. See: https://www.google.com/search?q=permissions+for+%22%2Fvar%2Flib%2Frabbitmq%22
/var/lib/rabbitmq directory should have permissions set to 755
.erlang.cookie file should have permissions set to 600
Digging a bit deeper, this is being caused by my docker-compose.yml mapping into the /config/ directory. On Windows, Docker Compose bind mounts do not support file permissions. There has been some discussion of Docker adding an opt-in feature for better explicit permission control, but it isn't ready yet. This has been a long standing issue for years that has impacted my own development work because the documentation was really inadequate.
It looks like /config/ is where the rabbitmq .erlang.cookie file ends up. If that cookie could be allowed to go to an image filesystem path or even a named volume, instead, then the permissions on that file could be correct in an environment like this.
I get that maybe running docker-unms on Ubuntu on WSL2 on Windows is not the preferred way to run it. Is there a strong need to have the .erlang.cookie in the config directory bind mount? Or maybe an alternative recommended setup using named volumes?