consumer: Cannot connect to amqp://user:**@localhost:5672//: [Errno 111] Connection refused consumer: Cannot connect to amqp://user:**@localhost:5672//: [Errno 111] Connection refused docker docker

consumer: Cannot connect to amqp://user:**@localhost:5672//: [Errno 111] Connection refused


From within your airflow containers, you should be able to connect to the service rabbit1. So all you need to do is to change amqp://user:**@localhost:5672//: to amqp://user:**@rabbit1:5672//: and it should work.

Docker compose creates a default network and attaches services that do not explicitly define a network to it.

You do not need to expose the 5672 & 15672 ports on rabbit1 unless you want to be able to access it from outside the application.

Also, generally it is not recommended to build images inside docker-compose.


I solved this issue by installing rabbitMQ server into my system with command sudo apt install rabbitmq-server.