The error: “error: deprecated environment variables detected when Dropping container with RabbitMQ in Docker” is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
When dose this prolem appear?
RabbitMQ is an open source messaging brokering software (sometimes called message-oriented middleware) which utilizes the Advanced Message Queuing Protocol (AMQP).
RabbitMQ is a RabbitMQ server was written using the Erlang programming language, and is built upon the Open Telecom Platform framework for clustering and failover. Client-specific libraries that interface with the broker are provided for all the major programming languages.
When starting a Docker container with RabbitMQ, as a result, the image is downloaded, but the container does not start. You 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
How To Solve The Error: “error: deprecated environment variables detected when Dropping container with RabbitMQ in Docker”?
Option 1: RabbitMQ (3.9)
You must use the environment variable as defined below. We hope this information assists you in determining your error.
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= DEFAULT_PASS=
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
Option 2: For
If you are using
Dockerfile, type your config in this same folder and add this line to your
COPY ./rabbitmq.conf /etc/rabbitmq/rabbitmq.conf
Option 3: Rabbit version
If you are using Rabbit version of 3.8 and you would like to return the correct value. The variables will not throw those errors, refer to this command for verion 3.8 as follow:
The reason is the latest stable version of Rabbit, which is 3.9, which has deprecated those variables. If you want to keep using the latest version of rabbit, -> use a configuration file. Given that you’ve likely used 3.8 to this moment.
As mentioned ablove, RabbitMQ is an open source messaging brokering software which utilizes the Advanced Message Queuing Protocol (AMQP). So, it will appear many problems that you work on RabbitMQ. We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your error: “error: deprecated environment variables detected when Dropping container with RabbitMQ in Docker” quickly by following these steps!
If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!