Multi-host networking
In Chapter 7, Single-Host Networking, we discussed how containers communicate on a single Docker host. Now, we have a swarm that consists of a cluster of nodes or Docker hosts. Containers that are located on different nodes need to be able to communicate with each other. There are many techniques that can help one achieve this goal. Docker has chosen to implement an overlay network driver for Docker Swarm. This overlay network allows containers attached to the same overlay network to discover each other and freely communicate with each other. The following is a schema for how an overlay network works:
Overlay network
We have two nodes or Docker hosts with the IP addresses 172.10.0.15
and 172.10.0.16
. The values we have chosen for the IP addresses are not important; what is important is that both hosts have a distinct IP address and are connected by a physical network (a network cable), which is called the underlay network.
On the node on the left-hand side we have a container...