dockerrabbitmqrebus

How can you resolve a docker RabbitMq endpoint from Rebus


I am running RabbitMQ in a docker container and need to access it from Rebus, which is also running but in a separate Docker container. Instead of localhost I am using host.docker.internal. My RabbitMQ container is on port 5673 so I am setting this as my connection string for the Rebus transport: amqp://host.docker.internal:5673

However, when running this exception occurs when Rebus is initializing the bus instance:

System.ArgumentException HResult=0x80070057 Message=No ip address could be resolved for host.docker.internal Source=RabbitMQ.Client StackTrace: at RabbitMQ.Client.TcpClientAdapter.d__2.MoveNext()

I also tried switching the port back to the default 5672 and used just amqp://host.docker.internal and received the same exception.


Solution

  • It was host.docker.internal:5673... I was just seeing an error regarding IPv6 in the RabbitMQ client library and assumed the connection was bad. It fell back on IPv4 and succeeded.