Use it when containers on one host cannot reach each other or the internet.
Docker Bridge Networks
1. docker network inspect <net> — containers and subnets.
2. Name resolution between containers on the same network.
3. Outbound: docker exec <c> ping 8.8.8.8 / DNS.
4. sysctl net.ipv4.ip_forward = 1.
5. iptables DOCKER chains present.
container veth → docker bridge → NAT → host network
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
ip addr show docker0 ; bridge linkVerification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 How to verify Verify boundary
From inside one container, resolve and connect to the other by name. From the host, ping the container IP on the bridge. Check that ip_forward is enabled with sysctl net.ipv4.ip_forward.
Step 2 Common failures Narrow the fault
Containers on different user-defined networks cannot reach each other unless connected to a shared network. A host firewall that flushes iptables removes Docker's rules. Overlapping bridge subnets with corporate networks break routing to those networks.
Create a user-defined network for each app (docker network create). Containers on different networks are isolated. Docker adds iptables NAT rules — host firewall tools may interact.
docker ps -a— containers and exit codesdocker logs <c>— container outputdocker inspect <c>— config, mounts, network, state
ReferenceWhat it is1 section · depth on demand
How it works
Docker creates a Linux bridge per network and a veth pair per container. The embedded DNS server at 127.0.0.11 answers names of containers on the same user-defined network. Docker writes iptables rules for masquerade and published ports; disabling iptables management breaks both.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
A Docker bridge network is a Linux bridge (docker0 or br-<id>) with one veth pair per container. Outbound traffic is masqueraded to the host's address; inbound traffic only arrives through published ports.
Default bridge vs user-defined bridge
Default bridge | User-defined bridge | |
|---|---|---|
| Name resolution between containers | No (only legacy --link) | Yes, embedded DNS at 127.0.0.11 |
| Isolation | All unattached containers together | Only containers on that network |
| Connect/disconnect while running | No | Yes (docker network connect) |
| Per-network subnet and options | Daemon-wide only | Per network |
Always create a user-defined network for multi-container applications.
Worked trace of one packet
docker network inspect appnet -f '{{range .Containers}}{{.Name}} {{.IPv4Address}}{{"\n"}}{{end}}'
ip -br link show master br-3f1c2a # veth interfaces attached to the bridge
iptables -t nat -S POSTROUTING | grep 172.30.0.0/24
# -A POSTROUTING -s 172.30.0.0/24 ! -o br-3f1c2a -j MASQUERADE
The MASQUERADE rule is what lets containers reach the outside world; if a host firewall flushes the NAT table, outbound traffic from containers stops until Docker is restarted.
Subnet clashes
Docker picks bridge subnets from 172.17.0.0/16 upwards. If that overlaps a company or VPN range, containers cannot reach those hosts. Set default-address-pools in /etc/docker/daemon.json to a free range before creating networks.
Common mistakes
- Expecting DNS between containers on the default bridge.
ReferenceConfiguration & state1 section · depth on demand
Bridge network commands
docker network ls
docker network create --driver bridge --subnet 172.30.0.0/24 appnet
docker run -d --network appnet --name api myapi
docker network inspect appnet
ip addr show docker0 ; bridge link
Documented example, not captured output. User-defined bridges provide DNS by container name; the default bridge network does not. Docker adds iptables/nftables NAT rules for outbound traffic and published ports.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.