CONTAINERS / A CONCEPT NOTE
Container Networking
how containers find each other
Overview · mechanism
pitfall · examples
01 / THE SHORT VERSION
The idea in a few sentences.
Containers use virtual network interfaces (veth pairs) linked to a virtual bridge (docker0). The bridge routes packets locally, while iptables rules translate port bindings for external traffic.
02 / FOLLOW THE MECHANISM
How packet passing flows
Creation
container runtime creates a veth pair, placing one end inside the container namespace.
Bridge Link
places the other end of the pair on the host's virtual bridge (e.g. docker0).
IP allocation
assigns a private IP address (like 172.17.0.2) to the container interface.
Port Forwarding
iptables translates traffic landing on host port 80 to container IP port 8080.
04 / COMMAND NOTES
Read the command, then the result.
Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.
list all local container networks
docker network lsinspect IP allocations and bridge configuration
docker network inspect bridge05 / CHECK YOURSELF
Could you explain Container Networking to a teammate?
Try it out loud in two sentences: what it is, and the one detail that changes the picture. If you stall, the gap is the part to reread.
Up next in Containers & KubernetesVolumes & Persistencedata that survives restarts