Interview's MateDocker
Interview's Mate

Docker

Compose · Networking · Security · Ops

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Docker topics
Lesson 62/ 160
04. Docker Networking

Default Docker Networks (bridge, host, none)

Know what bridge, host, and none networks give you out of the box.

Beginnerbridge · host3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

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 -t for 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

Loading interactive 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.

Concrete bridge setup

docker network ls; docker run --rm --network none alpine:3.21 ip addr; docker run --rm --network host nginx:1.27 nginx -t

Key takeaway: Prove host with 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.

Deliberate failure test

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.

Key takeaway: Defaults are predictable for one host; host mode loses isolation and none mode removes any accidental external dependency.

How it works, step by step

Step 1 of 4
Design

1. 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.

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.
Key numbers at this step
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 image in 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

Explicit bridge
Best for: Know what bridge, host, and none networks give you out of the box, with a reviewed runbook.

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.

Ambient default
Best for: Short-lived host experiments with low blast radius.

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.

Managed none
Best for: Teams that centralize none policy across many workloads.

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 -t as proof and skipping compare 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 -t address 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?
Interview tip: Give one concrete operation-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

Loading quiz

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.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Container Network Model (CNM) & libnetwork Basics
Next topic
Default Bridge vs User-Defined Bridge Networks