M
M
Mikhail Trainin2021-08-25 06:15:26
Docker
Mikhail Trainin, 2021-08-25 06:15:26

How to connect to 0.0.0.0 from inside a docker container?

I have two docker-compose.yml config files.
In one file, I launch a service that is displayed at 0.0.0.0:15672 (everything works fine in the browser)
And in the second file, I raise a service that interacts with the service from the first file.

But when I try to connect to 0.0.0.0:15672 from the second service, it gives a Connection Error.
If you start the second service without docker - everything works.
If you wrap it in a docker - no.

How to fix it?

PS - The option to combine two config files into one and connect by container name is not suitable.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2021-08-25
@Stormx480

By default, each file has its own subnet.
In order for both applications to work on the same network, then as an option, create a network in one docker-compose.yml and use the same network with the external: true flag in the second.
You can read in the docs https://docs.docker.com/compose/networking/#use-a-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question