Sample Header Ad - 728x90

Connect 2 docker-containers through docker-compose

1 vote
2 answers
2520 views
I'am trying to connect web- application, deployed from one container, to rabbitmq, deployed at another container. By relying on this Connecting to RabbitMQ container with docker-compose , I created the following docker-compose: version: '3' services: webapp: container_name: chat build: context: . depends_on: - broker ports: - "8080:8080" broker: container_name: rabbit_chat image: rabbitmq command: rabbitmq-server expose: - 5672 - 15672 healthcheck: test: ["CMD", "curl", "-f", "http://broker:5672 "] interval: 30s timeout: 10s retries: 5 webapp is a service of web-application, at which I prescribe following rabbitmq-properties: host = broker port = 15672 login = guest password = guest I selected 'broker' as a host, as in documentation recommended to connect containers by default-net, using the name of service in docker-compose. And this does not work.Also I tried to use "localhost" as host for connection. Additionally, inspecting container "rabbit_chat" I see in output: "Log": [ { "Start": "2020-04-11T14:54:25.0988242Z", "End": "2020-04-11T14:54:25.2920557Z", "ExitCode": -1, "Output": "OCI runtime exec failed: exec failed: container_linux.go:346: starting container process caused \"exec: \\\"curl\\\": executable file not found in $PATH\": unknown" }
Asked by Jelly (133 rep)
Apr 12, 2020, 07:40 AM
Last activity: Jul 4, 2025, 03:01 AM