I have three docker containers:
- rabbitmq (with management plugin enabled)
- consumer (multithreaded python application using pika)
- producer (multithreaded python application using pika)
Both consumer and producer are able to connect to the rabbitmq queue, but messages sent from the producer never reach the consumer. Actually, they are not even seen on the rabbitmq instance (I have verified this via the management interface)
I have tried lots of different combinations to connect to the rabbitmq docker instance: 0.0.0.0
network, 172.17.x.x
network, ... Currently I am using amqp://guest:[email protected]:5672
, which is working (I am able to open a connection), but does not allow sending messages.
From the host I must use http://0.0.0.0:55673
to connect to the management interface (55673
being the mapped management port)
The same configuration without docker is working fine: rabbitmq running as host service (or even in the cloud), and my consumer/producer as plain processes. Connection is fine, and messages are delivered.
What could be the reason why the connection is being opened just fine, but messages are not delivered when using docker?
What tests could I perform to further narrow the problem?
EDIT
The rabbitmq consumer shows the following in the log:
=INFO REPORT==== 11-May-2016::14:25:54 ===
accepting AMQP connection <0.687.0> (172.17.0.3:53576 -> 172.17.0.2:5672)
=INFO REPORT==== 11-May-2016::14:26:06 ===
accepting AMQP connection <0.825.0> (172.17.0.4:48607 -> 172.17.0.2:5672)
The other containers have an empty log
EDIT2
This is how I run the rabbitmq container:
docker run -d -p 5672:5672 -p 55673:15672 --hostname my-rabbit --name rabbitmq rabbitmq:3.6.1-management
EDIT3
Same effect when connecting containers to a custom bridge:
docker network create -d bridge mynet
docker run --net mynet --name rabbitmq ...
docker run --net mynet --name consumer ...
docker run --net mynet --name producer ...
Hosts can ping each other by name (using the DNS provided by the docker daemon), and I can thus use the hostname to connect to the RabbitMq server.
The connection is established but the messages are not delivered.
Very strange, since the ping packets are reaching the other container just fine.
docker logs
of the 3 containers? – user2915097rabbitmq:3.6.1-management
. The consumer and producer are based onpython:3-onbuild
– blueFast