Understanding Docker Networking#

The mental model#

Linux networking is just C code in the kernel simulating switches and routers in memory. It’s simply the system passing a packets in RAM from one function to the next. Once you accept that, everything becomes much easier to follow.

Network Modes#

Docker has seven network drivers. Each controls how containers reach the host, each other, and your LAN.

Driver Summary
bridge Default. Private virtual switch with NAT to the host.
host Shares the host network stack. No isolation.
none Loopback only. No network access.
macvlan Each container gets its own MAC and LAN IP.
ipvlan L2 Own LAN IP, shared parent MAC.
ipvlan L3 Host routes container subnets. No broadcast.
overlay Multi-host networking over VXLAN. Requires Swarm.