I never intended this chapter to be a full reproduction of the official Docker documentation; I am just trying to explain some of the key concepts that will help you as you progress through the rest of this book.
Docker networking is an interesting topic, and by default, Docker supports the following network modes:
- bridge
- host
- none
- overlay
The bridge network is the default network that your containers will connect to when you launch them; this is how we were able to join our containers together in the last example. To facilitate this, Docker uses some of the core Linux capabilities such as networking namespaces and virtual Ethernet interfaces (or veth
interfaces).
When the Docker engine starts, it creates the docker0
virtual interface on the host machine. The docker0
interface is a virtual Ethernet bridge that automatically forwards packets between any other network interfaces that are attached to it. When a container starts it creates a veth
pair, it gives one...