Home > Software design >  Docker RabbitMQ runs then stops
Docker RabbitMQ runs then stops

Time:12-18

I am trying to follow this tutorial on setting up docker clusters https://levelup.gitconnected.com/setting-up-rabbitmq-cluster-c247d61385ed

I get to running the following command that I will need to run for the other two nodes

docker run -d --rm --net rabbit -v C:\RabbitPrototype\config\rabbit-1/:/config/ -e RABBITMQ_CONFIG_FILE=/config/rabbitmq -e RABBITMQ_ERLANG_COOKIE=ABCDYJLFQNTHDRZEPLOZ --hostname rabbit-1 --name rabbit-1 -p 8081:15672 rabbitmq:3.9-management

I can see it run in the docker graphical container view, but after a couple seconds it disappears, as seems that the container stops running, what do I need to do order to keep it running, are there any logs to look at to see why it stopped?

I have removed the --rm mentioned by @Omer

I get this error

2021-12-16 16:24:41.403174 00:00 [erro] <0.130.0> Failed to load advanced configuration file "/config/rabbitmq.config": 1: syntax error before: '.'

My config file that I am trying to load looks like this, copied from the tutorial page, so currently not sure what the issue is with the . (dot) between then users.guest part on line one?

loopback_users.guest = false
listeners.tcp.default = 5672
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config
cluster_formation.classic_config.nodes.1 = rabbit@rabbit-1
cluster_formation.classic_config.nodes.2 = rabbit@rabbit-2
cluster_formation.classic_config.nodes.3 = rabbit@rabbit-3

CodePudding user response:

The issue from the error message seems to be that RabbitMQ thinks you are providing it an advanced configuration file instead of the normal configuration file - https://www.rabbitmq.com/configure.html#advanced-config-file . Even though since RabbitMQ 3.7 has sysctl(the format you used) kind of configuration files, the advanced configuration file still uses the classic configuration format(https://www.rabbitmq.com/configure.html#config-file-formats) which explains the syntax error.

From the docs - https://www.rabbitmq.com/configure.html#configuration-files

Not sure why it would pick the value of the RABBITMQ_CONFIG_FILE as the advanced config file instead of the default one.

Can you update the question with the full logs? Even after the container is dead, you can check its logs using docker logs rabbit-1

CodePudding user response:

I seem to have something running with this command now running this, I renamed the rabbitmq.config to rabbitmq.conf and also told it to put it in the /etc/rabbitmq/ which seems to be the default location

docker run --net rabbit -v C:\\RabbitPrototype\config\rabbit-1\:/etc/rabbitmq/ -e RABBITMQ_ERLANG_COOKIE=ABCDYJLFQNTHDRZEPLOZ --hostname rabbit-1 --name rabbit-1 -p 8081:15672 rabbitmq:3.9-management
  • Related