Glasnhost
Glasnhost

Reputation: 1135

Can't connect to dockerized rabbit from clients

I installed and ran rabbitmq on docker from https://hub.docker.com/_/rabbitmq/:

docker ps
24551542aa20        repo/rabbitmq-example-server:latest   "/docker-entrypoin..."   23 hours ago        Up 2 hours          4369/tcp, 5671-5672/tcp, 15671/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp   rabbitmq-example-server

I can login on the admin with http://localhost:15672/ From terminal I can use rabbitmqadmin succesfully for all the examples here http://www.rabbitmq.com/management-cli.html, adding -u admin -p nimda for authentication. I can publish and receive messages.

However, python and ruby clients cannot connect. TCP connection is refused or hangs. I tried localhost,127.0.0.0.1 or my ip, nothing. The port 5672 is not even reachable with telnet and I see it declared in rabbitmq.config:

{ tcp_listeners, [ 5672 ] },

Upvotes: 2

Views: 868

Answers (1)

Glasnhost
Glasnhost

Reputation: 1135

Just found the answer while writing the post :-)

 nmap -p 5672 localhost

gives

PORT     STATE  SERVICE
5672/tcp closed amqp

So I stopped and removed the container and restarted again with

docker run -d -p 5672:5672 -p 15672:15672  --name rabbitmq rabbitmq

and now nmap gives

5672/tcp open  amqp

and clients are connecting. I don't know why the rabbitmqadmin was to connect...

Upvotes: 2

Related Questions