The default bridge network
How a container on docker0 gets an address, reaches the internet through NAT, and why the default bridge has no DNS and is not for production.
The default bridge network
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- Every container gets its own network namespace with an eth0. Unless told otherwise, Docker connects it to the default network, named bridge, built on the Linux bridge docker0.
- A veth pair is the virtual cable: one end is eth0 in the container, the other is plugged into docker0 on the host.
- The default bridge usually takes 172.17.0.0/16, with the host's docker0 at 172.17.0.1 acting as every container's gateway.
- Outbound traffic is masqueraded, so the outside world sees the host's address. Inbound traffic from outside reaches a container only through a published port.
- Containers on the default bridge can reach each other only by IP address. There is no name resolution between them, and --link is legacy.
- Docker's docs call the default bridge a legacy detail not recommended for production. Use user-defined networks.
A process with its own network
A container is a process in its own network namespace. Inside, it has a loopback interface and nothing else, so it cannot reach anything. Docker’s job is to give it a way out and, when asked, a way in. On a default installation, that way is a single shared network called bridge. Every container you start without --network lands on it.
Understanding how this network is wired explains most of the confusing things about Docker networking: why one direction works and the other does not, why names do not resolve, and what 172.17.0.1 is.
The wiring
Three Linux pieces, set up by Docker:
- A bridge.
docker0is a software switch on the host, created when the daemon starts. The host has an address on it, normally172.17.0.1/16. - A veth pair per container. A virtual Ethernet cable with two ends. One end is moved into the container’s namespace and named
eth0. The other stays on the host, with a name likevethe3a1f2c, plugged intodocker0. - Firewall rules. NAT rules so containers can reach outside and published ports can reach in.
Think of docker0 as an office network switch, and the host as the office’s router. Each container is a desk with a cable to the switch and a private address. Desks can talk to each other through the switch. To reach the internet, traffic goes through the router, which rewrites the source to the office’s public address.
On a Linux host you can see the pieces with the ip command:
ip addr show docker0 # the bridge and its 172.17.0.1 address
ip link show master docker0 # the host ends of every container's veth pair
docker network inspect bridge # subnet, gateway, and the containers attached
Addresses
The networking overview lists Docker’s built-in address pools, starting with 172.17.0.0/16, which the default bridge normally takes. A /16 holds 65,534 host addresses, so the default bridge is never short of IPs. Docker picks each container’s address from it, and the gateway in the container’s routing table is 172.17.0.1, the host’s end of the bridge. Docker tries to avoid prefixes already in use on the host, but a corporate network or VPN that uses 172.17.0.0/16 can still clash, which is a common reason to change it.
The default bridge is configured in /etc/docker/daemon.json, not with docker network create:
{
"bip": "192.168.200.1/24",
"default-address-pools": [{ "base": "10.99.0.0/16", "size": 24 }]
}
bip sets the bridge’s own address and subnet. default-address-pools sets where user-defined networks get theirs. Both need a daemon restart.
Out: masquerading
When a container connects to example.com, the packet leaves eth0, crosses the veth pair into docker0, and is routed by the host to its real interface. On the way out, a masquerade rule rewrites the source address from 172.17.0.5 to the host’s address. Replies come back to the host, which reverses the translation. The bridge driver docs summarize it: devices on the host’s external networks only see the IP address of the Docker host. The routing lesson covers the forwarding underneath. This is also why Docker turns on IP forwarding on the host and, as the firewall lesson explains, sets the FORWARD policy to drop.
In: only through published ports
The reverse does not work by default. Nobody outside the host has a route to 172.17.0.5, and Docker’s rules drop direct attempts anyway. The only way in from outside is a published port, -p 8080:80, where the host accepts the connection and forwards it to the container. That is publishing ports and the host firewall.
From the host itself, the container’s IP is reachable directly on Linux, because the host is on the bridge. On Docker Desktop the bridge is inside a VM, so only published ports work from your Mac or Windows machine.
Why the default bridge is not enough
The bridge driver page is blunt: the default bridge network “is considered a legacy detail of Docker and is not recommended for production use”. Its shortcomings, from the same page:
- No name resolution. Containers can reach each other only by IP address. IPs change every time a container is recreated, so hard-coding them breaks. Containers get a copy of the host’s
/etc/resolv.conf, which is fine for the internet and useless for finding each other. The old fix,--link, is legacy. - Everything shares it. Every container started without
--networkcan talk to every other one on any port. Unrelated stacks are not isolated. - Hard to change. Taking a container off the default bridge means recreating it, and the bridge’s settings apply to every container on it and need a daemon restart.
User-defined bridge networks fix all three, which is why Compose creates one for every project. The default bridge is still worth understanding, because it is what docker run gives you, and because user-defined bridges are built from exactly the same parts.
About the video
The embed is KodeKloud’s “How Docker Networking Actually Works”, June 2026, 9 minutes. Its chapters cover the container networking problem, what a bridge network is, what “host machine” means, the veth pair as a virtual cable, the container IP, bridge IP and gateway, the outbound journey through NAT, why inbound connections fail, and the two rules that explain it. It does not cover DNS or the default bridge’s limits, which the lesson adds. YouTube reports an English original audio track. NetworkChuck’s chapter in deeper shows the same network with ip and docker network inspect on a real host.
What was run: nothing touched a network. The pool sizes were computed with Python’s ipaddress module from the default pools listed in the networking overview. The wiring, NAT behaviour and the default bridge’s limits are from the bridge driver page and the networking overview in the docker/docs repository, checked 2026-11-28. The ip commands are standard iproute2 and were not run here.
Where this fits
The default bridge works but has no names and no isolation. Next, the networks you should actually use: user-defined networks and container DNS.
Check yourself
Two containers, web and db, are started with no --network flag. In web, ping db fails with bad address, but pinging db's IP works. Why?
Both are on the default bridge, which has no DNS between containers. Only user-defined networks resolve container names. Create a network and attach both to it.
A container can curl https://example.com, but nobody on the LAN can reach the web server inside it. Why does one direction work and not the other?
Outbound connections are masqueraded behind the host's address, so replies come back. Inbound connections need a published port with -p, because the container's address is private to the host.
Inside a container, what is at 172.17.0.1 on a default installation?
The docker0 bridge on the host, which is the container's default gateway. Services on the host that listen on that address, or on all addresses, are reachable there.
You change the default bridge's subnet in daemon.json because it clashes with your office VPN. When does it take effect?
After restarting the Docker daemon. The default bridge is configured with daemon options such as bip, unlike user-defined networks, which are configured when created.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.