Container networking enables communication between containers, with external services, and across multiple hosts. In Docker, networking is implemented through pluggable drivers (bridge, overlay, host, macvlan, ipvlan, none), each serving different use cases from single-host isolation to multi-host orchestration. Kubernetes extends this with its own networking model requiring that all pods can communicate with each other without NAT, managed through CNI (Container Network Interface) plugins that provide the actual network implementation. Understanding container networking is essential because network isolation, DNS resolution, service discovery, and load balancing are fundamental to microservices architectures — without proper networking configuration, containers remain isolated islands unable to collaborate as distributed systems.
What This Cheat Sheet Covers
This topic spans 12 focused tables and 142 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Network Drivers
| Driver | Example | Description |
|---|---|---|
docker network create -d bridge my-net | • Default Docker network driver creating an isolated network on a single host • containers on the same bridge can communicate, external access requires port publishing • uses Linux bridge ( docker0 by default) with automatic DNS resolution between containers on user-defined bridges. | |
docker network create -d overlay --attachable multi-host-net | • Enables multi-host container communication by creating a distributed network across Docker Swarm nodes • encapsulates container traffic using VXLAN tunneling over UDP port 4789 • requires Swarm mode even for standalone containers. | |
docker run --network host nginx | • Removes network isolation between container and host — container shares host's network namespace and uses host's IP directly • highest performance but no port isolation • published port flags ( -p) are ignored. |