Reputation: 145
I try to start a Docker container with RabbitMQ, as a result, the image is downloaded, but the container does not start. I get the following message in the logs:
error: RABBITMQ_DEFAULT_PASS is set but deprecated
error: RABBITMQ_DEFAULT_USER is set but deprecated
error: RABBITMQ_DEFAULT_VHOST is set but deprecated
error: RABBITMQ_ERLANG_COOKIE is set but deprecated
error: deprecated environment variables detected
This problem appeared recently, before that everything worked fine and started.
This is my docker-compose rabbit:
rabbit:
image: "rabbitmq:3-management"
hostname: "rabbit"
environment:
RABBITMQ_ERLANG_COOKIE: 'SWQOKODSQALRPCLNMEQGW'
RABBITMQ_DEFAULT_USER: 'user'
RABBITMQ_DEFAULT_PASS: 'bitnami'
RABBITMQ_DEFAULT_VHOST: '/'
ports:
- "15672:15672"
- "5672:5672"
labels:
NAME: "rabbitmq"
networks:
- postgres
Upvotes: 14
Views: 9412
Reputation: 648
If someone uses only Dockerfile
, add your config in this same folder and add this line to your Dockerfile
:
COPY ./rabbitmq.conf /etc/rabbitmq/rabbitmq.conf
Upvotes: 0
Reputation: 452
You should use the following environment varibles:
DEFAULT_VHOST=/
DEFAULT_USER=user1
DEFAULT_PASS=pass1
see https://www.rabbitmq.com/configure.html for more information.
Or use other versions of rabbitMQ like 3.8:
rabbitmq:3.8-management
Upvotes: 9
Reputation: 618
The latest stable docker image for RabbitMQ (3.9) has been recently updated and the official image page says:
As of RabbitMQ 3.9, all of the docker-specific variables listed below are deprecated and no longer used.
I have resolved the issue in following way:
Create a rabbitmq.conf file in the same folder where docker compose file is present
Put the variables in there following guidelines and naming convention from here. Something like:
default_vhost = /
default_user = user
default_pass = bitnami
In docker compose file, instead of an environment section put a volumes section and mounted the rabbitmq.conf file to proper path (depending on OS, follow here). For linux container it will be like:
rabbit:
image: "rabbitmq:3-management"
hostname: "rabbit"
volumes:
- "./rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf"
ports:
- "15672:15672"
- "5672:5672"
labels:
NAME: "rabbitmq"
networks:
- postgres
Upvotes: 10
Reputation: 119
The line
image: "rabbitmq:3-management"
Basically (I think) gets the latest stable version of Rabbit, which is 3.9, which has deprecated those variables. If you wish to keep using the latest version of rabbit, you must use a configuration file. Seeing as how you've probably been using 3.8 up until this point, I imagine that's more work than it's worth. You can use 3.8 instead by changing the line to:
image: "rabbitmq:3.8-management"
The variables are not deprecated in this version and will not throw those errors.
Upvotes: 8