0

I am running rabbitmq container in docker using the command: docker run --hostname indoor-rabbitmq -d -p 15672:15672 -p 5672:5672 --name indoor-rabbitmq $DOCKER_NAME which using authentication auth_cache.cached_backend http which is running on localhost. And also, I dont want to run rabbitmq using --net=host. But rabbitmq is not able to send the request to the authentication service built using nodejs running on localhost and neither is the service able to login to rabbitmq using amqp, giving the error: localhost econnrefused. How do I make RabbitMq running in docker connect(send request)to the service running on localhost? Or a more general question: How to communicate between container and localhost without running --net=host?

Rajan Shah
  • 95
  • 1
  • 2
  • 10
  • `localhost` is a very context-specific thing; in Docker it usually means "this container", and every process is running "on localhost" even if it's on a different physical system. Can you clarify which processes are running in containers (with a container-specific `localhost`) and which not? – David Maze Jun 16 '20 at 21:40
  • rabbitmq is running on docker and localhost in reference to this question is 127.0.0.1 on the system and not of the localhost of docker. – Rajan Shah Jun 16 '20 at 21:52
  • PLAIN login refused: rabbit_auth_backend_cache failed authenticating indoor-pubsub: {failed_connect, [{to_address, {"localhost", 9085}}, {inet, [inet], econnrefused}]} : is the error, where service is running on localhost 9085 and rabbitmq is running on docker – Rajan Shah Jun 16 '20 at 21:53
  • [From inside of a Docker container, how do I connect to the localhost of the machine?](https://stackoverflow.com/q/24319662/10008173) discusses the various ways to connect from a container to the host system; you might see if one of the approaches there work. – David Maze Jun 17 '20 at 10:44

0 Answers0