Container networking
Network namespace
A separate copy of the kernel's network: its own cards, addresses, routes and firewall, which is what a container's network is.
A network namespace is a separate copy of the Linux network stack: its own cards, addresses, route table, ARP
cache and iptables rules, starting with only lo. Programs inside see no other network. A container's network is
one; Docker makes one per container. ip netns add web makes a named one, ip netns exec web <command> runs a
command inside it, and ip -n web addr reads it from outside.
Read next
- veth pair Two virtual cards joined like the ends of a cable: what goes in one comes out the other, even across namespaces.
- Switch Joins devices into one network, forwarding each frame toward the port its destination MAC was seen on.
- Published port A host port forwarded to a container's port with a DNAT rule, so others reach a container through its host.