Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

741
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda