Use it when containers cannot reach each other or the outside, or a published port does not answer.
Networks
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.
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
Operational reference
Fast context before you go deeper.
Verification & 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 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
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 · 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.
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.
docker ps -a / podman ps -a— containers and statedocker logs <c>— container outputdocker inspect <c>— configuration, mounts, networkdocker 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:
| Driver | Behaviour |
|---|---|
| bridge (default) | A private network on the host; NAT to the outside |
| host | No network isolation; the container uses the host's stack |
| none | No networking |
| overlay | Spans several Docker hosts (Swarm) |
| macvlan | Containers appear as separate devices on the physical network |
| ipvlan | Containers 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)
| Syntax | Effect |
|---|---|
-p 8080:80 | Host port 8080 to container port 80, on all host addresses (0.0.0.0 and ::) |
-p 127.0.0.1:8080:80 | Only reachable from the host itself |
-p 53:53/udp | UDP |
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
| Element | Choice |
|---|---|
| One user-defined network per application | Containers find each other by name; other apps are isolated |
| Only the reverse proxy publishes ports | Applications reachable only through the proxy |
| Backends on internal networks | docker network create --internal has no route out |
| Published ports bound to specific addresses | Avoid 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.
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:
| Driver | Behaviour |
|---|---|
| bridge (default) | NAT behind docker0; user-defined bridges add DNS by container name |
| host | Shares host network namespace |
| none | No network |
| macvlan/ipvlan | Container gets its own L2/L3 address on the LAN |
| overlay | Multi-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.
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
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
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%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%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.
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.
Quick lookup tables
Networks operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Networks.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | 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. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin 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 chain | container endpoint → netns interface/address → bridge/veth → route/neighbor → firewall/NAT → host/external path → service socket | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Network 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 evidence | Correlated Linux container/virtualization evidence can establish this proof path: container endpoint → netns interface/address → bridge/veth → route/neighbor → firewall/NAT → host/external path → service socket | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It 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 check | Continue 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 boundary | Networks |
|---|---|
| Topic path | Containers → Networks |
| Runtime state | 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. |
| 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 chain | container 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 boundary | Network 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 rule | Prove 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 boundary | Topic-specific reference |
|---|---|
| Objects | Docker network + endpoint + container netns |
| Bridge path | veth → host bridge → forwarding/NAT/uplink |
| Published port | Host exposure separate from container listener |
| Proof | Exact source namespace flow + return path |