H
H
HoHsi2016-08-10 21:31:08
linux
HoHsi, 2016-08-10 21:31:08

How to set up networking in Docker?

Good afternoon! There is one machine, and Nginx is
running on it - 2 containers (with volumes up to docker.sock) that want to communicate with Nginx through a public address, i.e. example.ru , not the container address. Faced such a problem, if we make, say, ping example.com from one container


PING example.ru (192.168.1.147) 56(84) bytes of data.
64 bytes from example.ru (192.168.1.147): icmp_seq=1 ttl=64 time=0.069 ms
64 bytes from example.ru (192.168.1.147): icmp_seq=2 ttl=64 time=0.058 ms
64 bytes from example.ru (192.168.1.147): icmp_seq=3 ttl=64 time=0.057 ms

Those. This is the local address given by the router.
And accordingly, if you go to this host / address via curl
curl example.ru
curl: (7) Failed to connect to example.ru port 80: No route to host

Tried to solve this problem via --net=host , but in this case it builds inside the container
Build failed (system failure): container already exists

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question