Chapter 17Lesson 03~115 minutes

Container Networking Foundations: Bridge, Host, None, User-Defined Networks, Endpoints, and Namespaces: Configuration, Design Choices, and Tradeoffs

Choose among default bridge, user-defined bridge, host, none, internal, single-homed, multi-homed, and explicit addressing designs using observable network state and platform constraints.

Network designHost/noneInternal networksMulti-homingTradeoffs

Learning objectives

  • Choose user-defined bridge over the default bridge for scoped same-host application connectivity and stable name-based discovery.
  • Explain when host or none networking is justified and why host mode is a portability/isolation tradeoff rather than a universal performance fix.
  • Design single-homed versus multi-homed service topology and use internal networks to reduce unintended external paths.
  • Use static addressing only when a real external protocol/integration constraint requires it, while keeping names and explicit network membership as the normal identity model.
  • Tie each choice to reproducibility, auditability, failure isolation, developer experience, host cost, and observable state.
Design rule. Pick a network mode because it expresses the required trust and reachability boundary, not because it makes one failing request pass. Every extra attachment expands the set of peers and routes a process can reach.

1. Decision table

Choice Prefer when Tradeoff / prerequisite Evidence to keep
User-defined bridge Same-host application components need scoped communication and name-based discovery. Single-host scope; host firewall/NAT still matters for external paths. Network ID/driver/IPAM, endpoint membership, DNS lookup, routes.
Default bridge Very small throwaway experiments only. Shared legacy network, weaker discovery ergonomics, unrelated containers can accumulate together. Explicit proof that default network is acceptable for the experiment.
Host network Workload truly requires host stack semantics, many ports, or measured NAT overhead reduction. Reduced network isolation; no port mapping; Linux/opt-in Desktop constraints. Platform/version, listener ports, host conflicts, justification.
None Workload must not use networking. No peer/external communication. Container network mode plus loopback-only evidence.
Internal user-defined network Components should communicate with peers but not have normal external connectivity. No default route to other networks; gateway/host interactions remain platform-specific. Internal flag, endpoint membership, route test.
Multiple attachments A deliberate gateway/front-back/debug pattern needs access to separate trust zones. Larger attack/connectivity surface and more route/DNS complexity. All endpoint IDs, per-network aliases/IPs, routes, intended traffic matrix.
Static IP External system/protocol requires an address contract that DNS/alias cannot satisfy. Allocation management, subnet coupling, collision risk, poorer portability. Subnet/gateway/IPAM ownership and change procedure.

2. Default bridge versus user-defined bridge

The legacy default bridge is daemon-wide shared state. User-defined bridges are application-scoped objects that Docker can label, inspect, configure, and attach/detach dynamically. Docker explicitly recommends user-defined bridges for most same-host multi-container applications because they provide automatic name resolution and better isolation.

That does not mean a user-defined bridge is a security boundary equal to a host firewall or separate VM. Containers on the same user-defined bridge can communicate freely with each other's exposed/listening ports. Membership therefore matters.

3. Host versus isolated networking

Host mode deliberately removes one layer of network namespace isolation. On Linux, the process uses the host network namespace, avoiding bridge NAT and separate endpoint addressing. This can reduce some networking overhead and simplify large port ranges, but it also creates host port conflicts and couples behavior tightly to platform policy.

none takes the opposite position: keep the container process/filesystem model but give the workload no normal network path. It is suitable for offline transforms, local batch steps, or tests that should prove they do not depend on network access.

4. Single-homed versus multi-homed services

A single endpoint makes reachability easy to reason about: one network identity, one peer set, one subnet/gateway context. A dual-homed service can legitimately bridge roles—for example, a frontend connected to both an ingress-facing network and an internal application network. But every additional network creates another trust path.

Do not confuse “attached to both networks” with “routing between networks.” A dual-homed container receives endpoints on both networks, but forwarding traffic between them requires additional kernel/application behavior that this chapter deliberately does not enable.

5. Internal networks

docker network create --internal creates an externally isolated network. Current Docker documentation states that containers can communicate with peers on the internal network, but no normal default route to other networks is configured and Docker firewall policy drops cross-network external traffic. This is a useful data-tier pattern when a component should not initiate arbitrary outbound traffic.

docker network create   --driver bridge   --internal   --label devops-academy.lab=network17-design   da-net17-internal

docker network inspect da-net17-internal --format   'name={{.Name}} id={{.Id}} driver={{.Driver}} internal={{.Internal}} ipam={{json .IPAM.Config}}'

docker network rm da-net17-internal

6. Static IP addressing: exception, not service-discovery default

Docker can allocate from explicit subnets and can assign a requested endpoint IP. Use that only when an integration genuinely depends on an address. Most application-to-application dependencies should use a name or alias on a scoped network because recreation can then change addresses without changing the service contract.

If static addressing is required, record the subnet, gateway, reserved ranges, ownership, collision checks, and migration plan. A hard-coded address without those controls is fragile configuration, not reproducibility.

7. iptables versus nftables: keep the abstraction boundary

On current Linux Engine, Docker defaults to iptables for bridge-network firewall rules. Engine 29 adds an experimental nftables backend selected through daemon configuration. Both are host-level implementation choices; the container still experiences interfaces, routes, DNS, and connectivity. Do not teach application teams to edit Docker-owned rule tables to make a lab pass.

If an organization chooses the nftables backend, that is a platform engineering change requiring its own migration plan, forwarding review, Swarm limitations review, and rollback. It is outside this disposable chapter lab.

8. Docker Desktop is not a native-Linux bridge host

Docker Desktop uses a managed Linux VM for Linux containers. Host networking is opt-in from Desktop 4.34+ and is documented as layer-4 only. Use Docker API/network inspection and container-visible evidence as the portable teaching layer; avoid assuming a Windows/macOS host has the same docker0/veth topology as a native Linux Engine host.

9. Worked scenario: three-tier local application

Suppose a development application has web, api, and db. A defensible design is: web on front + back, api on back + data, and db only on an internal data network. The host publishes only the web entrypoint. No component uses a hard-coded container IP.

Service Networks Why
web front, back Receives client traffic and calls API.
api back, data Accepts web requests and calls database.
db data (internal) No need to reach front network or external clients.

Before executing such a topology, predict each endpoint membership and expected DNS name. After execution, verify with docker network inspect and docker inspect. Network design becomes auditable when the intended traffic matrix and actual endpoint set agree.

Next lesson

Next: Diagnostics, Failure Modes, Security, and Performance

Apply the design model to realistic failures: wrong network membership, localhost confusion, flat-network overexposure, host-mode portability, and premature published-port debugging.

Knowledge check

When is a user-defined bridge normally the right default?

Does a dual-homed container automatically route traffic between its two networks?

What does --internal express?

Why are static container IPs usually a poor service identity?

Why is host networking a tradeoff rather than a “better bridge”?

Official references and version notes

Version baseline checked 2026-09-21.

Docker Engine 29.8.1 is the current Engine release baseline used for version-sensitive discussion. Docker Engine on Linux uses iptables by default for bridge-network firewall rules; the nftables backend introduced in Engine 29 remains experimental. Docker Desktop host networking is supported from Desktop 4.34+ as an opt-in feature and operates at layer 4. Always record the installed Engine/Desktop version and actual network/firewall state before drawing conclusions.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this address.