Docker RabbitMQ 运行然后停止

Docker RabbitMQ runs then stops

我正在尝试按照本教程设置 docker 集群 https://levelup.gitconnected.com/setting-up-rabbitmq-cluster-c247d61385ed

我得到运行宁我将需要运行用于其他两个节点的以下命令

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

我可以在 docker 图形容器视图中看到它 运行,但几秒钟后它就消失了,好像容器停止了 运行ning,我需要什么为了保持它 运行ning,是否有任何日志可以查看它停止的原因?

我已经删除了@Omer

提到的--rm

我收到这个错误

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: '.'

我尝试加载的配置文件看起来像这样,是从教程页面复制的,所以目前不确定 . (点)在第一行的 users.guest 部分之间?

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

错误消息中的问题似乎是 RabbitMQ 认为您正在向它提供高级配置文件而不是普通配置文件 - 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) 这解释了语法错误。

来自文档 - https://www.rabbitmq.com/configure.html#configuration-files

不确定为什么它会选择 RABBITMQ_CONFIG_FILE 的值而不是默认值作为高级配置文件。

你能用完整的日志更新问题吗?即使在容器死后,您也可以使用检查其日志 docker logs rabbit-1

我好像有点东西运行这个命令现在运行这个,我把rabbitmq.config重命名为rabbitmq.conf,还叫它放在/etc/rabbitmq/ 这似乎是默认位置

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