I am following the tutorial https://github.com/docker/dceu_tutorials/blob/master/6-networking.md to get a better understanding of Overlay Networking and Container Networking in general. It is great, really, but I have a questions which isn’t clear to me yet.
When I make a container network like so:
docker network create -d overlay --subnet=10.10.10.0/24 RED
and start a container like so:
DOCKERHOST1 $ docker run -itd --name container1 --net RED ubuntu
DOCKEHOST2 $ docker run -itd --name container2 --net RED ubuntu
(the last one on two different Dockerhosts, the first one is only needed on one dockerhost since they are connected to a third server running (in my case) consul).
When I list the network interfaces on container1 and container2, I see they have different ip’s for eth0 (the IP is coming from the RED network), but the eth1 address is the same on both dockerhosts:
eth1 Link encap:Ethernet HWaddr 02:42:ac:12:00:02
inet addr:172.18.0.2 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:acff:fe12:2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:648 (648.0 B) TX bytes:648 (648.0 B)
What is eth1 exactly ? I suspect it is an virtual interface for the overlay network, but when I was creating different networks, like:
docker network create -d overlay --subnet=10.100.10.0/24 GREEN
docker network connect GREEN container1
all I got was an extra IP address on the green network, not an extra address in the 172.18 subnet.