1

I'am trying to connect web- application, deployed from one container, to rabbitmq, deployed at another container.

I created the following docker-compose:

version: '3' services: webapp: container_name: chat build: context: . depends_on: - broker ports: - "8080:8080" networks: - chat_network broker: container_name: rabbit_chat image: rabbitmq hostname: broker ports: - "5672:5672" - "15672:15672" healthcheck: test: ["CMD", "curl", "-f", "http://broker:5672"] interval: 30s timeout: 10s retries: 5 networks: - chat_network networks: chat_network: external: name: chat_network 

webapp is a service of web-application, at which I prescribe following rabbitmq-properties:

host = broker port = 15672 login = guest password = guest 

And this does not work.

I entered I my containers. Inside rabbit_chat-container I send request (webapp:8080) successfully. But when I send "curl broker:5672 --output - " inside chat-container, I received: "curl: (56) Recv failure: Connection reset by peer".

Inside rabbit_chat-container I run "ncat -v --listen 5672". And receive "Ncat: bind to :::5672: Address already in use. QUITTING."

1 Answer 1

1

I had the same problem.

Solution: Default User: guest (and password: guest) only works for localhost by default.

Adding the following environment variables changing the default user to the docker-compose file for rabbitMQ fixes it.

environment: RABBITMQ_DEFAULT_USER: user RABBITMQ_DEFAULT_PASS: password 

Or, run the command directly docker run -d --hostname my-rabbit --name some-rabbit -e RABBITMQ_DEFAULT_USER=user -e RABBITMQ_DEFAULT_PASS=password rabbitmq:3-management

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.