Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

747
Views
How to configure rabbitmq.config inside Docker containers?

I'm using the official RabbitMQ Docker image (https://hub.docker.com/_/rabbitmq/)

I've tried editing the rabbitmq.config file inside the container after running

docker exec -it <container-id> /bin/bash

However, this seems to have no effect on the rabbitmq server running in the container. Restarting the container obviously didn't help either since Docker starts a completely new instance.

So I assumed that the only way to configure rabbitmq.config for a Docker container was to set it up before the container starts running, which I was able to partly do using the image's supported environment variables.

Unfortunately, not all configuration options are supported by environment variables. For instance, I want to set {auth_mechanisms, ['PLAIN', 'AMQPLAIN', 'EXTERNAL']} in rabbitmq.config.

I then found the RABBITMQ_CONFIG_FILE environment variable, which should allow me to point to the file I want to use as my conifg file. However, I've tried the following with no luck:

docker service create --name rabbitmq --network rabbitnet \
-e RABBITMQ_ERLANG_COOKIE='mycookie' --hostname = "{{Service.Name}}{{.Task.Slot}}" \
--mount type=bind,source=/root/mounted,destination=/root \
-e RABBITMQ_CONFIG_FILE=/root/rabbitmq.config rabbitmq

The default rabbitmq.config file containing:

[ { rabbit, [ { loopback_users, [ ] } ] } ]

is what's in the container once it starts

What's the best way to configure rabbitmq.config inside Docker containers?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

the config file lives in /etc/rabbitmq/rabbitmq.config so if you mount your own config file with something like this (I'm using docker-compose here to setup the image)

volumes:
- ./conf/myrabbit.conf:/etc/rabbitmq/rabbitmq.config

that should do it

over 4 years ago · Santiago Trujillo Report

0

I'm able to run RabbitMQ with a mounted config using the following bash script:

#RabbitMQ props
env=dev
rabbitmq_name=dev_rabbitmq
rabbitmq_port=5672

#RabbitMQ container
if [ "$(docker ps -aq -f name=${rabbitmq_name})" ]; then
    echo Cleanup the existed ${rabbitmq_name} container
    docker stop ${rabbitmq_name} && docker rm ${rabbitmq_name} 
    echo Create and start new ${rabbitmq_name} container
    docker run --name ${rabbitmq_name} -d -p ${rabbitmq_port}:15672 -v $PWD/rabbitmq/${env}/data:/var/lib/rabbitmq:rw -v $PWD/rabbitmq/${env}/definitions.json:/opt/definitions.json:ro -v $PWD/rabbitmq/${env}/rabbitmq.config:/etc/rabbitmq/rabbitmq.config:ro rabbitmq:3-management
else
    echo Create and start new ${rabbitmq_name} container
    docker run --name ${rabbitmq_name} -d -p ${rabbitmq_port}:15672 -v $PWD/rabbitmq/${env}/data:/var/lib/rabbitmq:rw -v $PWD/rabbitmq/${env}/definitions.json:/opt/definitions.json:ro -v $PWD/rabbitmq/${env}/rabbitmq.config:/etc/rabbitmq/rabbitmq.config:ro rabbitmq:3-management    
fi

I also have the following config files in my rabbitmq/dev dir

definitions.json

{
        "rabbit_version": "3.7.3",
        "users": [{
            "name": "welib",
            "password_hash": "su55YoHBYdenGuMVUvMERIyUAqJoBKeknxYsGcixXf/C4rMp",
            "hashing_algorithm": "rabbit_password_hashing_sha256",
            "tags": ""
        }, {
            "name": "admin",
            "password_hash": "x5RW/n1lq35QfY7jbJaUI+lgJsZp2Ioh6P8CGkPgW3sM2/86",
            "hashing_algorithm": "rabbit_password_hashing_sha256",
            "tags": "administrator"
        }],
        "vhosts": [{
            "name": "/"
        }, {
            "name": "dev"
        }],
        "permissions": [{
            "user": "welib",
            "vhost": "dev",
            "configure": ".*",
            "write": ".*",
            "read": ".*"
        }, {
            "user": "admin",
            "vhost": "/",
            "configure": ".*",
            "write": ".*",
            "read": ".*"
        }],
        "topic_permissions": [],
        "parameters": [],
        "global_parameters": [{
            "name": "cluster_name",
            "value": "rabbit@98c821300e49"
        }],
        "policies": [],
        "queues": [],
        "exchanges": [],
        "bindings": []
    }

rabbitmq.config

[
    {rabbit, [
        {loopback_users, []},
        {vm_memory_high_watermark, 0.7},
        {vm_memory_high_watermark_paging_ratio, 0.8},
        {log_levels, [{channel, warning}, {connection, warning}, {federation, warning}, {mirroring, info}]},
        {heartbeat, 10}
    ]},
    {rabbitmq_management, [
        {load_definitions, "/opt/definitions.json"}
    ]}
].
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!