How to setup RamitMQ with MQTT plugin enabled cluster in Rancher?

I’ve got the following docker file

FROM rabbitmq:3.7.8-management

ADD cluster-entrypoint.sh cluster-entrypoint.sh
RUN rabbitmq-plugins enable --offline rabbitmq_mqtt
RUN rabbitmq-plugins enable --offline rabbitmq_web_mqtt

And the cluster-entrypoint.sh is like this for now

#!/bin/bash

set -e

# Start RMQ from entry point.
# This will ensure that environment variables passed
# will be honored
/usr/local/bin/docker-entrypoint.sh rabbitmq-server -detached

# Do the cluster dance
rabbitmqctl stop_app
rabbitmqctl join_cluster rabbit@$1

# Stop the entire RMQ server. This is done so that we
# can attach to it again, but without the -detached flag
# making it run in the foreground
rabbitmqctl stop

# Wait a while for the app to really stop
sleep 2s

# Start it
rabbitmq-server

I managed then to launch the first instance successfully in Rancher and everything is running fine.

I then tried to create another container in order to join the cluster and I don’t know what to specify for the $1 in the above script.

I tried


I also tried to change it to the actual docker container id (by logging into rancher and gets it) unsuccessfully.

Here are the logs

DIAGNOSTICS
===========

attempted to contact: [rabbit@rabbitmq]

rabbit@rabbitmq:
  * unable to connect to epmd (port 4369) on rabbitmq: nxdomain (non-existing domain)

On local machine I ran it like this and it worked fine

docker run -d --hostname my-rabbit --name some-rabbit -e RABBITMQ_ERLANG_COOKIE='secret cookie here' -p 15672:15672 -p 5671:5671 rabbitmq_mqtt
docker run -it --rm --link some-rabbit:my-rabbit -e RABBITMQ_ERLANG_COOKIE='secret cookie here' --entrypoint=/cluster-entrypoint.sh rabbitmq_mqtt my-rabbit

Is there any settings in Rancher UI that I am missing?

I figured this out. thanks. I provided the wrong host.