A
A
Andrey Minisol2016-11-12 13:37:30
Nginx
Andrey Minisol, 2016-11-12 13:37:30

How does Docker work in terms of networking?

Good day.
I'm sorry if the question seems banal, but I can't figure out how docker works with the network.
Suppose there is a dedik with centos installed, one network interface (one external ip address) and docker with two docker containers installed on this dedik.
Each docker container has the same packages installed, the difference is only in versions and configurations, let's say it's nginx, php, apache, memcache, mysql and something else.
The first docker container contains a project with the address test1.com, and the second one is test2.com, respectively.
Actually, the question itself is, how does the resolv of all this happen, because all requests will fall on a dedicated ip, which should be proxyed to the docker container? Or in general how it all works, I do not understand (

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey, 2016-11-13
@AmadeyMinisol

after all, all requests will fall on a dedicated ip, which should be proxyed to a docker container?

requests fall on the port, due to this, magic happens. The docker daemon updates the routing rules in iptables.
https://fralef.me/docker-and-iptables.html - here you can read more about how it works.

A
Armenian Radio, 2016-11-12
@gbg

On a dedicated host, magic nginx can sit with magic rules for proxying different URLs to different containers.

M
moropsk, 2016-11-12
@moropsk

as an option.
https://habrahabr.ru/post/310460/eax.me/docker
_

M
Maxim Kudryavtsev, 2016-11-12
@kumaxim

Read about setting up a network in the official documentation. Everything is clearly written there.
In a nutshell: when creating a docker mesh, you create a virtual adapter with your own IP. The adapter works in bridge mode by default. How to send requests to this adapter further depends on your task.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question