CraigM
CraigM

Reputation: 621

RabbitMQ docker container persistence on Windows

I've created a docker-compose.yml file and when trying to "up" it, I'm failing to have my RabbitMQ docker container persisting to my host volume. It's complaining about the erlang cookie file not being accessible by owner only.

Any help with this would be greatly appreciated.

EDIT

enter image description here

So I added the above volume binding and rabbitmq seems to be placing files into that directory when I do a docker-compose up. I then add 2 messages and I can see via the rabbitmq console that the 2 messages are sitting in the queue...but then when I perform a docker-compose down followed by a docker-compose up, expecting the 2 messages to still be there as the directory and files were created, but they aren't and the message count=0 :(.

Upvotes: 0

Views: 3107

Answers (1)

Alejandro Galera
Alejandro Galera

Reputation: 3691

Maybe it's trying to access some privileged user functions.

Try adding privileged: true section to your docker-compose service in yml and do docker-compose up again.

If it works and you prefer to do some privileges, only what RabbitMQ needs, replace privileged: true by capability section for adding or dropping privileges:

cap_add:
  - ALL
  - <WHAT_YOU_PREFER>

cap_drop:
  - NET_ADMIN
  - SYS_ADMIN
  - <WHAT_YOU_PREFER>

For further information, please check Compose file documentation

EDIT:

In order to provide data persistency when containers fails, add volumes section to docker-compose.yml file volumes: /your_host_dir_with_data:/destination_in_docker

Upvotes: 1

Related Questions