Closed KeithWoods closed 6 years ago
It shouldn't be needed (and indeed would fail), since we are running as the rabbitmq
user (or another non-root user if --user
was used on the docker run) after the gosu
on line 9.
Thanks for the reply. Given my behaviour isn't expected let me try recreate the steps and report back else this can be closed.
I've had some occasional crashes with my rabbitmq container with the same error message. If I run the following command, it sometimes raises this issue (after about 50 tries or so)
docker run -d --hostname rabbit --name rabbitmq-host -p 8080:15672 -p 5672:5672 rabbitmq:3.6.12-management && docker exec -i rabbitmq-host rabbitmqctl wait /var/lib/rabbitmq/mnesia/rabbit@rabbit.pid
If I reboot the host the containers are running on, it always results in a crashing container for the first time the command is executed.
My guess is that the daemonized container returns and then quickly the host tries to docker exec
the rabbitmqctl command, which runs against the container daemon not having been able to update the permissions on the cookie?
Btw, adding --user rabbitmq
to both run and exec seems to work as expected and doesn't crash the container.
Closing given that this appears to be resolved and/or environmental. If this can be reproduced, a new issue outlining the exact steps we can take to reproduce would be grand. Thanks!
To be perfectly honest I am not sure if it is really reproducible since I've encountered it and it is just randomly poping up. But I think this might be useful for those who are using docker-compose and env variables: https://github.com/kasir-barati/nestjs-materials/blob/2cbb5f5fdea0876d7a809bd75bd255726e4c918b/microservices/complex-reservation-rabbitmq/compose.yaml
In a nutshell I've added:
In my compose.yaml
:
services:
# ...
message-brocker:
image: rabbitmq:4.0-rc-management-alpine
# ...
user: ${RABBITMQ_DEFAULT_USER}
Then in my .env
file:
RABBITMQ_URI=amqp://rabbitmq:password@message-brocker:5672
RABBITMQ_DEFAULT_USER=rabbitmq
RABBITMQ_DEFAULT_PASS=password
I bumped into this again today. And even though I just copied and pasted my previous docker compose file it did not work. So first thing I realized was that I was using "root"
as a value for RABBITMQ_DEFAULT_USER
. So I changed it to "rabbitmq"
and removed the containers altogether (docker compose down -v
). And now everything was working just fine.
I'm trying to get clustering working and noticed I was getting this error on the node that first ran the cluster operation:
my script is doing this:
If I add in the below before I interact with rabbit it seems to work fine.
Should the above
chown
be under this line? https://github.com/docker-library/rabbitmq/blob/29121864d4892b2481706df023a53e31fececd02/docker-entrypoint.sh#L139