S
S
Sergey Sokolov2017-07-23 13:26:02
Docker
Sergey Sokolov, 2017-07-23 13:26:02

How can I connect from a container to another container without a name?

nginx in a separate container catches all incoming requests and proxies them to web applications in other containers. One of the containers does not exist at the time of (re)starting nginx, so you cannot specify it like this:

location / {
    proxy_pass   http://container_name:1234;
}

A working container listening on port 1234 on the host via the expose parameter -p 1234:5678will appear later.
How to configure proxy_passin nginx to direct to a container listening on the host without specifying the container name? What to specify ip?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
planc, 2017-07-23
@planc

you need to add depends_on to docker-compose so that nginx starts after the required service
https://docs.docker.com/compose/startup-order/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question