Pcornel
Browse topics
Options
Recent
Favorites
Containers · Technical reference

Container Networking

Direct answer

Container networking connects containers to each other and the outside: Docker bridge networks with NAT and port publishing, host networking, and in Kubernetes a flat pod network provided by a CNI plugin plus Services for stable access.

When to use this

Use it when containers cannot reach each other, the internet, or be reached from outside.

First 30 seconds

1. Inside: docker exec <c> getent hosts <name> / kubectl exec <pod> -- nslookup <svc>.

2. IP and route inside the container.

3. Published port / Service endpoints present?

4. Listening address inside (ss -ltn).

5. Firewall/NetworkPolicy.

Operational verification

container netns → veth → bridge/CNI → routing/NAT → service/ports

Evidence · next step

Typical failures include an application bound only to loopback, wrong published port, missing return path, overlapping subnets, DNS/service-name confusion, MTU problems on overlays and policy/NAT rules that differ between host and namespace. Preserve the first divergent observation and repeat the same bounded verification after remediation.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
What not to infer

Networking owns general routing/switching/protocol depth. Containers owns container namespace, bridge, overlay, port-publishing and CNI behavior as it affects workloads.

Platform / version applicability
Docker / containerd / Podman / Kubernetes / OCI-compatible platforms
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.

PlatformDocker / containerd / Podman / Kubernetes / OCI-compatible platforms · Networking owns general routing/switching/protocol depth. Containers owns container namespace, bridge, overlay, port-publishing and CNI behavior as it affects workloads.
Scope / prerequisiteUse it when containers cannot reach each other, the internet, or be reached from outside.
What next?3 suggested next steps
Child topics (this level)4
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.

2 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 Verification workflow Verify boundary

Trace one flow end to end: source → host/overlay path → container namespace → destination socket, then back. Verify addresses/routes, bridge or CNI attachment, port publication, DNS resolution and policy separately; use packet capture at the first uncertain boundary when state views disagree.

Step 2 Failure signatures and limits Narrow the fault

Typical failures include an application bound only to loopback, wrong published port, missing return path, overlapping subnets, DNS/service-name confusion, MTU problems on overlays and policy/NAT rules that differ between host and namespace.

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.

test · 1
Drill down

Subtopics

Go one level deeper into this subject.

Key points

Test from inside the container. Containers reach each other by name only on user-defined networks (Docker) or via Service DNS (Kubernetes). Apps must listen on 0.0.0.0, not 127.0.0.1.

Key checks
  • docker ps -a — containers and exit codes
  • docker logs <c> — container output
  • docker inspect <c> — config, mounts, network, state
ReferenceWhat it is1 section · depth on demand

Operating model

Container Networking explains how container namespaces connect to host interfaces, bridges, NAT, overlays and service-discovery systems. The critical distinction is between the application listen socket inside the container, namespace reachability, host-side publication and any upstream routing/firewall path.

ReferenceHow it works1 section · depth on demand

In depth

Container networking connects containers to each other and to the outside world. On a single host, containers get interfaces in their own network namespace, usually attached to a Linux bridge with NAT for outbound traffic and port publishing for inbound. In Kubernetes, CNI plugins give every pod a routable IP.

ModeBehaviour
Bridge (default Docker)Private subnet, NAT outbound, -p host:container inbound
HostShares host network stack — no isolation, no port mapping
macvlan/ipvlanContainer appears directly on the LAN
OverlayMulti-host networks (VXLAN)
NoneNo networking
CNI plugin (Kubernetes)Notes
CalicoRouting (BGP) or overlay, network policies
CiliumeBPF dataplane, policies, observability
FlannelSimple overlay, no policies on its own
docker network inspect bridge
ip netns list; nsenter -t <pid> -n ip addr       # inspect a container's namespace

Published Docker ports bypass host firewall rules (ufw/firewalld) because Docker programs its own iptables/nftables rules — use the DOCKER-USER chain or bind to specific addresses.

ReferenceImportant terms & boundaries1 section · depth on demand

Scope map

  • Bridge networking
  • Host networking
  • Port publishing and NAT
  • Overlay networking
  • macvlan/ipvlan concepts
  • Container DNS and service discovery
  • CNI fundamentals
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical examples

Configuration & expected output

Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.

Configuration example

Docker Engine / Linux Docker Engine 24 or laterUser-defined bridge network so containers resolve each other by name.

Assumptions: Two containers on one host. Replace names and subnet.

docker network create --driver bridge --subnet 172.30.0.0/24 appnet
docker run -d --name db --network appnet postgres:16
docker run -d --name api --network appnet -p 8080:8080 myorg/api:1.0

Expected output

Docker Engine / Linux Docker Engine 24 or laterdocker exec api getent hosts db

Expected state: The api container resolves db through Docker's embedded DNS to an address in the appnet subnet.

172.30.0.2      db
Name resolution works only on user-defined networks, not the default bridge. Reachability of the database port is a separate check. Illustrative authored output: field layout matches the tool, values will differ in your environment.
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-29 · vendor docOCI / Docker / containerd / Kubernetes Docker Engine current documentation

Documentation verification: confirms the upstream model used by the Topic. It does not assert local production behavior.

Basis: https://docs.docker.com/engine/network/ · confidence 92%
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
container networkingcontainer networkDocker bridgeCNIcontainer port publishing
Embedded reference data

Quick lookup tables

Container Networking verification boundary matrix

A compact lookup separating intent, owning component state, effective state and consumer-visible outcome for Container Networking.

BoundaryInspectHealthy interpretationDo not infer
IntentBridge networkingIntended object/scope is explicit and versioned where relevantIntent is already effective
Owning runtime/control planeHost networking / Port publishing and NATOwner accepts and reports the expected object stateDownstream dependencies are healthy
Effective stateOverlay networkingIndependent read-back matches the intended stateEvery client sees the same result
Consumer outcomemacvlan/ipvlan conceptsThe original bounded check succeeds in the same time windowProduction correctness outside this scope
Depth when you need it

Deep reference

Design & tradeoffs

Scope

Networking owns general routing/switching/protocol depth. Containers owns container namespace, bridge, overlay, port-publishing and CNI behavior as it affects workloads.

Confirmation

Confirm action

Continue?