简体   繁体   中英

docker-compose not loading definitions.json for RabbitMQ

I am experimenting with Docker to create a container for RabbitMQ on my Windows 11 laptop. Doing the basics I can get it to run without error. So, from this I tried to have expand it by adding to the compose yaml file the definitions.json. The definitions.json I simply downloaded the definitions straight from the UI.

My docker-compose.yml looks like this:

version: "3.8"
 services:
  rabbitmq:
          image: rabbitmq:3-management
          container_name: 'rabbitmq'
  ports:
    - 5672:5672
    - 15672:15672
  volumes:
    - ./definitions.json:/etc/rabbitmq/definitions.json
    - ~/.docker-conf/rabbitmq/data/:/var/lib/rabbitmq/
    - ~/.docker-conf/rabbitmq/log/:/var/log/rabbitmq
  networks:
    - rabbitmq_go_net

networks:
  rabbitmq_go_net:
    driver: bridge

Now, when I run the compose file, it runs without any error at all, but none of the queues are visible in the UI. I have tried various things, but it appears as though the definitions.json is being ignored. As a further check, I did reload the definitions through the UI and queues reappeared.

So, how do you configure the docker compose file to load the definitions.json when creating a container from docker compose up?

Actually, the problem was the location where the definitions.json is meant to be stored. Some websites I have read have it located in the rabbitmq folder. However, I followed this link https://thomasdecaux.medium.com/deploy-rabbitmq-with-docker-static-configuration-23ad39cdbf39 and it worked. The other point to make is ensuring there is a rabbitmq.conf file to load the definitions.json file - this is critical to load the file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM