'Docker RabbitMQ in detached mode logging
I am running RabbitMQ in the docker container in detached mode. I am doing this so I can set some values using rabbitmqctl.
I added tail -f /dev/null so the container doesn't shutdown
However when I do this, I get no logging from the docker container.
How can I run rabbitmq-server -detached AND get logging to the "console"?
Solution 1:[1]
docker logs -f [container name or container ID]
will give you the container log. If rabbitmq logs to an specific file you can then do:
docker exec [container name or container ID] tail -f [PATH to the rabbot mb log file]
To get the container ID or name in case that you don't know it use:
docker ps
Solution 2:[2]
One alternative is to set RABBITMQ_LOG_BASE
to a shared volume directory.
In your dockerfile, add:
ENV RABBITMQ_LOG_BASE="/var/log/foo"
Then, run the container with:
docker run -d -v /var/log/bar:/var/log/foo your_image
Then you can get the data directly in your host in the directory /var/log/bar
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Carlos |
Solution 2 |