I am build an image using Dockerfile, and I would like to add users to RabbitMQ right after installation. The problem is that during build hostname of the docker container is different from when I run the resultant image. RabbitMQ loses that user; because of changed hostname it uses another DB.
I connot change /etc/hosts
and /etc/hostname
files from inside a container, and looks that RabbitMQ is not picking my changes to RABBITMQ_NODENAME
and HOSTNAME
variables.
The only thing that I found working is running this before starting RabbitMQ broker:
echo "NODENAME=rabbit@localhost" >> /etc/rabbitmq/rabbitmq.conf.d/ewos.conf
But then I will have to run docker image with changed hostname all the time.
docker run -h="localhost" image
Any ideas on what can be done? Maybe the solution is to add users to RabbitMQ not on build but on image run?