Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

persistent shared data directory not working after deleting container #22

Closed
rajalokan opened this issue Mar 5, 2016 · 2 comments
Closed

Comments

@rajalokan
Copy link

I've deployed a rabbitmq container using docker-compose which works absolutely fine. But when I stop the service, remove the container and then restart again I don't see rabbitmq data persistent.

Here is how to reproduce it:

docker-compose.yml:

rabbitmq:
  image: dockerfile/rabbitmq
  container_name: rabbitmq
  volumes:
    - /srv/docker/osod/rabbitmq:/data/mnesia
  ports:
    - "5672:5672"
    - "15672:15672"

Dockerfile

Same as https://github.com/dockerfile/rabbitmq/blob/master/Dockerfile

Steps:

docker-compose up -d rabbitmq
docker exec -it rabbitmq rabbitmqctl list_users
    Listing users ...
    guest   [administrator]
docker exec -it rabbitmq rabbitmqctl add_user user1 123
    Creating user "user1" ...
docker exec -it rabbitmq rabbitmqctl set_permissions user1 ".*" ".*" ".*"
    Setting permissions for user "user1" in vhost "/" ...
docker exec -it rabbitmq rabbitmqctl list_users
    Listing users ...
        user1   []
        guest   [administrator]

Now when I stop, remove and start container again

docker-compose stop
docker rm $(docker ps -aq --filter "status=exited")
docker-compose up -d rabbitmq
docker exec -it rabbitmq rabbitmqctl list_users
    Listing users ...
    guest   [administrator]

As we can see user1 is missing. Can you please suggest where I'm doing wrong. Doing same with mysql persisted data works though.

@PeterHajdu
Copy link

Hi @rajalokan,

I've just had a similar problem and the solution was to set a fix hostname for the rabbitmq container. rabbitmq creates the database directory using the hostname. If it is not fix, it recreates a folder each time the container is started and does not reuse the previous one which contains all persisted messages.

@sdejean28
Copy link

sdejean28 commented Jun 19, 2017

one solution is to tell rabbitmq which node name to use with an environmental variable in the rabbitmq definition :
environment:
RABBITMQ_NODENAME: node@rabbitmq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants