Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

Networks

Direct answer

Container networks connect containers: the default bridge (NAT to the host), user-defined bridges with DNS between containers, host networking and macvlan/overlay networks.

When to use this

Use it when containers cannot reach each other or the outside, or a published port does not answer.

First 30 seconds

1. docker network ls / inspect <net> — containers attached?

2. Inside: docker exec <c> getent hosts <other>.

3. Published: docker port <c> and ss -ltnp on the host.

4. App listening on 0.0.0.0 inside?

5. Firewall/DOCKER-USER rules.

Operational verification

container attached to a network → IP and DNS → bridge/NAT → published port → client

Evidence · next step

For Containers → Networks, continue with the first unproven Topic check: Pin exact host, runtime/hypervisor, object identity, source revision/image/definition and failing workload. If that boundary is healthy, advance to the adjacent check: Read back effective runtime state including process, namespace/resource or virtual-hardware boundaries. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it when containers cannot reach each other or the outside, or a published port does not answer.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

7 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

container endpoint → netns interface/address → bridge/veth → route/neighbor → firewall/NAT → host/external path → service socket

Healthy evidence: expected namespace/interface/address/route and host forwarding/NAT state carry the intended flow to the service

Step 2 Verification and output interpretation Verify boundary

Verification chain. container endpoint → netns interface/address → bridge/veth → route/neighbor → firewall/NAT → host/external path → service socket

Step 3 Specialized verification Verify boundary

Inspect network membership, container addresses/routes and the host veth/bridge path. From the source namespace, resolve the destination name and test the exact port. For published access, trace host listener/NAT/firewall and return path. Use namespace-aware socket and packet inspection when necessary. A network object existing in Docker does not show the endpoint is attached, route selected or application listening.

Step 4 Commands Verify boundary
docker network ls
docker network inspect bridge
docker network create appnet
Step 5 Failure modes and next checks Narrow the fault

Suspicious evidence: container has an IP but wrong namespace, bridge, DNS, route, MTU, firewall/NAT or listener breaks the actual connection

Network attachment or an assigned IP is not end-to-end connectivity evidence.

Step 6 Special cases and limits Narrow the fault

Container DNS success does not show TCP/application reachability. Host firewall and Docker-managed NAT can alter published traffic independently of container-internal policy. Overlapping subnets can route traffic to the wrong interface without any Docker error. Host network mode removes much namespace isolation. Keep Docker network object, Linux netns/link state, host forwarding/NAT and service socket separate.

Step 7 Common mistakes Narrow the fault
  • Containers on the default bridge expecting name resolution.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

Use user-defined networks so containers resolve each other by name. Published ports (-p host:container) go through NAT on the host. Check the app listens on 0.0.0.0 inside the container, not 127.0.0.1.

Key checks
  • docker ps -a / podman ps -a — containers and state
  • docker logs <c> — container output
  • docker inspect <c> — configuration, mounts, network
  • docker info — engine, storage driver, cgroup version
ReferenceImportant terms & boundaries6 sections · depth on demand

What this shows and what it does not

Network attachment or an assigned IP is not end-to-end connectivity evidence.

In depth

Container networking: drivers, DNS and published ports

Docker connects containers to networks through drivers. The Docker networking overview describes them:

DriverBehaviour
bridge (default)A private network on the host; NAT to the outside
hostNo network isolation; the container uses the host's stack
noneNo networking
overlaySpans several Docker hosts (Swarm)
macvlanContainers appear as separate devices on the physical network
ipvlanContainers connected to external VLANs

On the default bridge, containers reach each other only by IP address. On user-defined networks, they can also use container names, through Docker's embedded DNS server at 127.0.0.11.

Published ports (port publishing documentation)

SyntaxEffect
-p 8080:80Host port 8080 to container port 80, on all host addresses (0.0.0.0 and ::)
-p 127.0.0.1:8080:80Only reachable from the host itself
-p 53:53/udpUDP

The documentation calls publishing "insecure by default": without an address, the port is reachable from outside the host. It also notes that publishing creates firewall rules on the host.

Design for a typical application host

ElementChoice
One user-defined network per applicationContainers find each other by name; other apps are isolated
Only the reverse proxy publishes portsApplications reachable only through the proxy
Backends on internal networksdocker network create --internal has no route out
Published ports bound to specific addressesAvoid accidental exposure
host$ docker network create appnet
host$ docker network create --internal dbnet
host$ docker run -d --name db --network dbnet postgres:16
host$ docker run -d --name api --network appnet registry.example.net/report-api:1.4.2
host$ docker network connect dbnet api
host$ docker run -d --name proxy --network appnet -p 443:443 nginx:1.27
host$ docker exec api getent hosts db
172.19.0.2      db
host$ docker exec db sh -c 'wget -qT3 -O- http://example.com >/dev/null && echo online || echo isolated'
isolated
host$ docker network inspect appnet -f '{{range .Containers}}{{.Name}} {{.IPv4Address}}{{"\n"}}{{end}}'
host$ sudo ss -tlnp | grep docker-proxy

Reading the example

api resolves db by name, because they share the user-defined network dbnet. That network is internal, so the database container can't reach the Internet. Only the proxy publishes a port. That's the one place where firewall rules and TLS need to be right.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

Networks is part of Containers → Networks. Container Networks map runtime endpoints into Linux network namespaces using bridges/veth/routing/NAT or other drivers and must be verified from both namespace and client paths.

Topic-specific state model. Container Networks map runtime endpoints into Linux network namespaces using bridges/veth/routing/NAT or other drivers and must be verified from both namespace and client paths.

Specialized mechanics

Docker networking connects container network namespaces through drivers such as bridge, host, none and overlay-style designs. Bridge networks normally use veth pairs, a host bridge, IPAM and host forwarding/NAT for published ports. DNS/service-name behavior is network-driver dependent. A container can join multiple networks and therefore have multiple interfaces/routes; the default route and source address used for a flow matter. Published ports are host-side forwarding constructs and do not show that the process inside the container is listening on the expected address and port.

Quick reference

Docker networking:

DriverBehaviour
bridge (default)NAT behind docker0; user-defined bridges add DNS by container name
hostShares host network namespace
noneNo network
macvlan/ipvlanContainer gets its own L2/L3 address on the LAN
overlayMulti-host (Swarm)
docker network create appnet
docker run -d --network appnet --name db postgres:16
docker run -d --network appnet --name app -e DB_HOST=db app:1.4
docker network inspect appnet
nft list ruleset | grep -i docker

Published ports (-p) insert NAT rules that bypass UFW/firewalld INPUT rules — bind to 127.0.0.1:8080:80 or use the DOCKER-USER chain to restrict exposure.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. Network attachment or an assigned IP is not end-to-end connectivity evidence.

Snapshot/image existence is not a verified backup.

ReferenceConfiguration & state2 sections · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. Container Networks owns runtime network attachment; Linux Networking and Firewall own kernel path mechanics.

Specialized lifecycle

Choose user-defined networks for explicit service scope and DNS behavior rather than relying on incidental defaults. Define subnets/gateways only when they do not overlap host, VPN or routed infrastructure. Published ports are host exposure policy, not container-to-container policy. Avoid manual edits to Docker-owned nftables/iptables rules unless ownership is intentionally taken over. For multi-network containers, document which network carries ingress, egress and service discovery to avoid asymmetric routing.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Containers → Networks. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://docs.docker.com/engine/ · confidence 94%
2026-09-13 · vendor docDocker Engine current

Authoritative Linux project/vendor documentation reviewed for bounded reference claims: container network drivers, namespaces, published ports and host boundary. Documentation-based technical verification only; not lab or production-runtime proof. The schema vendor_doc method is used for authoritative project/vendor documentation; deployment applicability remains separate evidence.

Basis: https://docs.docker.com/engine/network/ · confidence 93%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

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.

Aliases that resolve here
docker networkscontainer networkingcontainer bridge network
Embedded reference data

Quick lookup tables

Networks operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for Networks.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateContainer Networks map runtime endpoints into Linux network namespaces using bridges/veth/routing/NAT or other drivers and must be verified from both namespace and client paths.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin host + object identity + source image/definition → verify host/runtime capability → read back effective process/namespace/cgroup or virtual-hardware state → verify storage/network attachments → verify guest/container readiness → repeat original workload + regression check.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chaincontainer endpoint → netns interface/address → bridge/veth → route/neighbor → firewall/NAT → host/external path → service socketTrace requested/configured state through effective state to the observed workload result.
Failure boundaryNetwork attachment or an assigned IP is not end-to-end connectivity proof.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux container/virtualization evidence can establish this proof path: container endpoint → netns interface/address → bridge/veth → route/neighbor → firewall/NAT → host/external path → service socketUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove unobserved clients, names, identities, routes, sessions, backends or time periods. Network attachment or an assigned IP is not end-to-end connectivity proof.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven runtime boundary, capture adjacent host/object/resource/attachment evidence, make only the demonstrated persistent change, then repeat the original workload plus a regression check.Continue to the next unresolved boundary while preserving the original test condition.

Networks · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryNetworks
Topic pathContainers → Networks
Runtime stateContainer Networks map runtime endpoints into Linux network namespaces using bridges/veth/routing/NAT or other drivers and must be verified from both namespace and client paths.
Fast checks- Pin exact host, runtime/hypervisor, object identity, source revision/image/definition and failing workload. - Read back effective runtime state including process, namespace/resource or virtual-hardware boundaries. - Trace storage and network attachments plus readiness from the real client or dependent workload path. - Apply the smallest persistent change, then repeat the original workload and an adjacent regression check.
Verification chaincontainer endpoint → netns interface/address → bridge/veth → route/neighbor → firewall/NAT → host/external path → service socket Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary.
Failure boundaryNetwork attachment or an assigned IP is not end-to-end connectivity proof. Boundary chain: process/socket namespace → source/rule/FIB → neighbor → netfilter/eBPF/qdisc → virtual/physical device → peer → return → application.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.

Networks · specialized operational reference

Topic-specific Linux mechanics, lifecycle, proof path and failure-boundary lookup.

Operational boundaryTopic-specific reference
ObjectsDocker network + endpoint + container netns
Bridge pathveth → host bridge → forwarding/NAT/uplink
Published portHost exposure separate from container listener
ProofExact source namespace flow + return path
Confirmation

Confirm action

Continue?