rabbitmq - why I need to add hostname to docker when creating a volume -


i'm creating rabbitmq container -v option add volume, weird part if don't add --hostname container no getting information of volume, example:

i create volume this:

docker volume create --name rabbit 

later verify volume created

docker volume ls 

then create container this:

docker run --name rabbitprueba -p -p 55555:15672 -d -v rabbit:/var/lib/rabbitmq rabbitmq:3.6.10-management 

i enter localhost:55555 , enter user , password, create simple queue, return machine , stop , remove container:

docker stop rabbitprueba docker rm rabbitprueba 

when run same command:

docker run --name rabbitprueba -p -p 55555:15672 -d -v rabbit:/var/lib/rabbitmq rabbitmq:3.6.10-management 

the queue created gone if repeat same steps (stop container , remove it) , add command --hostname queue not removed:

docker run --hostname rabbitprueba --name rabbitprueba -p -p 55555:15672 -d -v rabbit:/var/lib/rabbitmq rabbitmq:3.6.10-management 

why happening?, doing wrong?,

thanks in advance.

so doing nothing wrong, assuming problem docker. problem how rabbitmq saves data.

when launch rabbitmq container using below command

docker run -it rabbitmq:latest 

you notice in docker logs line showing

database directory @ /var/lib/rabbitmq/mnesia/rabbit@51267ba4cc9f empty. initialising scratch... 

next run:

database directory @ /var/lib/rabbitmq/mnesia/rabbit@5e9c67b4d6ed empty. initialising scratch... 

so can see creates folder based on hostname. if run

docker run -it --hostname mymq rabbitmq 

and log show

database directory @ /var/lib/rabbitmq/mnesia/rabbit@mymq empty. initialising scratch... 

so happening here. not problem volume, way rabbitmq works. possible change name of config using environment variables below

 docker run -it -e "rabbitmq_nodename=mq@localhost" rabbitmq 

and logs show

database directory @ /var/lib/rabbitmq/mnesia/mq@localhost empty. initialising scratch... 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -