Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dropping container with RabbitMQ in Docker

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
like image 282
Sergey karpov Avatar asked Jul 31 '21 07:07

Sergey karpov


1 Answers

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:

  1. Create a rabbitmq.conf file in the same folder where docker compose file is present

  2. Put the variables in there following guidelines and naming convention from here. Something like:

    default_vhost = /
    default_user = user
    default_pass = bitnami
    
  3. 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
    
like image 121
Mamun Reza Avatar answered Oct 01 '22 10:10

Mamun Reza