Default Docker Networks (bridge, host, none)
Know what bridge, host, and none networks give you out of the box.
In plain words
Choose bridge for ordinary isolated Linux containers, host for a documented compatibility/performance need, and none for a process that must not make network connections.
Think of it like…
Bridge gives an apartment a door to the shared street, host gives it the building’s own office address, and none seals the door but leaves the room itself.
Where you’ve seen it
In practice, docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -t is the concrete move for this job: know what bridge, host, and none networks give you out of the box. The release is not accepted until compare ip route and /proc/net/dev under bridge, host and none with the same image confirms the result.
Words you’ll hear
- bridge
- The implementation control in
docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -tfor know what bridge, host, and none networks give you out of the box. - host
- The result to observe with
compare ip route and /proc/net/dev under bridge, host and none with the same image, rather than infer from a successful command alone. - none
- The production boundary exposed when binding an app to 127.0.0.1 in a bridge container and expecting host or peer traffic to reach it.
Visual diagram
Theory & deep dive
bridge control path
The concrete mechanism is docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -t. The observable result is compare ip route and /proc/net/dev under bridge, host and none with the same image; if those disagree, inspect the runtime evidence before changing unrelated settings.
Know what bridge, host, and none networks give you out of the box. Keep bridge, host and none in the same deployment record so the intent and the observed state cannot drift apart.
docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -t
compare ip route and /proc/net/dev under bridge, host and none with the same image, not with command success alone.none failure boundary
Default driver names are not interchangeable with the identical-sounding Docker networking modes. A localhost inside a bridge container refers to itself, and a none container still has a loopback interface but no route to the host or internet. The narrow failure to design for is binding an app to 127.0.0.1 in a bridge container and expecting host or peer traffic to reach it.
Accept this compromise explicitly: Defaults are predictable for one host; host mode loses isolation and none mode removes any accidental external dependency. The controlled check-compare ip route and /proc/net/dev under bridge, host and none with the same image-also identifies the point where a different design is safer.
Exercise this failure safely: binding an app to 127.0.0.1 in a bridge container and expecting host or peer traffic to reach it.
How it works, step by step
Step 1 of 41. State the boundary
Write down why the workload needs this: Default driver names are not interchangeable with the identical-sounding Docker networking modes. A localhost inside a bridge container refers to itself, and a none container still has a loopback interface but no route to the host or internet.
- Intent
- bridge
When to use it & trade-offs
What it is
Docker normally creates bridge, host and none. bridge is a local NAT network with connectivity but legacy service-discovery limitations; host shares the daemon host network namespace on supported Linux; none creates no external interface beyond loopback.
Why it matters: Default driver names are not interchangeable with the identical-sounding Docker networking modes. A localhost inside a bridge container refers to itself, and a none container still has a loopback interface but no route to the host or internet.
When to reach for it
- The fit is strongest for this job: know what bridge, host, and none networks give you out of the box. Pair it with
compare ip route and /proc/net/dev under bridge, host and none with the same imagein the runbook. - Production bridge changes should make host observable through
docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -t, rather than trusting the runtime default. - Keep a rollback example for the case where binding an app to 127.0.0.1 in a bridge container and expecting host or peer traffic to reach it.
When to avoid or be careful
- Do not accept command success while the system can still fail by binding an app to 127.0.0.1 in a bridge container and expecting host or peer traffic to reach it.
- Avoid erasing none protection merely to dodge this cost: “Defaults are predictable for one host; host mode loses isolation and none mode removes any accidental external dependency”.
- Do not replace the evidence path-
compare ip route and /proc/net/dev under bridge, host and none with the same image-with a screenshot or a mutable tag.
docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -t: practical choices
Strengths: Docker normally creates bridge, host and none. bridge is a local NAT network with connectivity but legacy service-discovery limitations; host shares the daemon host network namespace on supported Linux; none creates no external interface beyond loopback.
Watch out: Defaults are predictable for one host; host mode loses isolation and none mode removes any accidental external dependency.
Strengths: It can begin with docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -t and fewer surrounding controls.
Watch out: It silently accepts binding an app to 127.0.0.1 in a bridge container and expecting host or peer traffic to reach it, which makes the result hard to reproduce after promotion.
Strengths: Default driver names are not interchangeable with the identical-sounding Docker networking modes. A localhost inside a bridge container refers to itself, and a none container still has a loopback interface but no route to the host or internet.
Watch out: The platform adds an ownership and debugging layer; retain compare ip route and /proc/net/dev under bridge, host and none with the same image as the direct check.
Interview signals & numbers to know
When this topic comes up
- docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -t
- compare ip route and /proc/net/dev under bridge, host and none with the same image
- Failure signature: binding an app to 127.0.0.1 in a bridge container and expecting host or peer traffic to reach it
- Trade-off: Defaults are predictable for one host; host mode loses isolation and none mode removes any accidental external dependency.
Benchmarks & rules of thumb
- 3 default networks
- bridge, host and none
- 1 loopback interface
- still present under none
- 0 automatic DNS
- between containers on the legacy default bridge
Common mistakes & follow-ups
Common interview mistakes
- Treating a successful
docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -tas proof and skippingcompare ip route and /proc/net/dev under bridge, host and none with the same image. - Binding an app to 127.0.0.1 in a bridge container and expecting host or peer traffic to reach it
- Optimizing bridge without accepting that defaults are predictable for one host; host mode loses isolation and none mode removes any accidental external dependency.
Likely interviewer follow-ups
- Why does
docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -taddress bridge here rather than through application code? - How would you distinguish healthy host from the failure “binding an app to 127.0.0.1 in a bridge container and expecting host or peer traffic to reach it” using
compare ip route and /proc/net/dev under bridge, host and none with the same image? - When would this trade-off-“Defaults are predictable for one host; host mode loses isolation and none mode removes any accidental external dependency”-justify a different none design?
docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -t-and one proof-compare ip route and /proc/net/dev under bridge, host and none with the same image. Then name the boundary: binding an app to 127.0.0.1 in a bridge container and expecting host or peer traffic to reach it.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Default Docker Networks (bridge, host, none) with generative AI interview Q&A and hands-on practice.