I am starting a docker container with RabbitMQ for testing purposes. I would like to start a second container which runs a short command and checks that the Rabbitmq is actually running. The second container should block my build pipeline until it has determined that RabbitMQ has successfully started in the first container.
How can I specify to rabbitmqctl
which hostname to use to get the status of RabbitMq? I am linking the two containers together via docker so port issues should not be a problem.
Example:
rabbitmqctl -n rabbitmq status # does not work, prints diagnostic info
Status of node rabbitmq@rabbitmq ... Error: unable to perform an operation on node 'rabbitmq@rabbitmq'. Please see diagnostics information and suggestions below.
Most common reasons for this are:
- Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
- CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
- Target node is not running
In addition to the diagnostics info below:
- See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more
- Consult server logs on node rabbitmq@rabbitmq
DIAGNOSTICS
attempted to contact: [rabbitmq@rabbitmq]
rabbitmq@rabbitmq: * connected to epmd (port 4369) on rabbitmq * epmd reports: node 'rabbitmq' not running at all other nodes on rabbitmq: [rabbit] * suggestion: start the node
Current node details: * node name: rabbitmqcli52@e3ea1e73df02 * effective user's home directory: /var/lib/rabbitmq * Erlang cookie hash: AB9AFN3zvcyAWBl6ZVVOJw==