Quiz Entry - updated: 2026.11.10
How does Docker's default bridge network connect containers to each other, to the host and to the internet?
Docker creates a virtual switch docker0 on the host; each container plugs into it through a veth pair, gets a private IP (172.17.0.0/16 by default), and reaches the internet through NAT done by iptables.
docker0. When Docker is installed, it creates a Linux bridge interfacedocker0on the host (typically172.17.0.1/16). A bridge behaves like a virtual switch.ip addr showlists it even when no container is running.vethpairs. For every container on the bridge, Docker creates a virtual Ethernet cable with two ends: one end appears in the container aseth0(for example172.17.0.2), the other end is plugged intodocker0and shows up on the host asvethXXXX@ifNN. Start two containers and two newvethinterfaces appear on the host.- Container to container. Containers on the same bridge reach each other through
docker0by IP. - To the internet. Outgoing traffic is translated by an iptables NAT (masquerade) rule to the host's address, which is why
ping google.chworks from a container. - From outside in. The host only forwards traffic into a container for ports published with
-p.
docker network inspect bridge shows the subnet, the gateway and every connected container with its IP.
* veth pairs into docker0, NAT out through the host NIC. *
Go deeper:
NetworkChuck: Docker networking is CRAZY!! — a hands-on tour of the bridge, user-defined bridges, host, macvlan and more.
Docker Docs: Bridge network driver — default versus user-defined bridges.
man7.org: veth(4) — the virtual Ethernet pair behind every bridge container.