NAT, publishing and reachability
In a typical Linux bridge using NAT, outbound traffic may have its source address translated to a host address. Published inbound traffic is mapped toward the container listener. Translation changes addressing; a firewall controls which traffic is permitted. An image EXPOSE declaration does not publish a port. A socket must actually listen on an address reachable from the chosen path. Routed gateway mode differs from the usual NAT model; do not assume the same host-port behavior. Docker documents a localhost publishing issue on releases before Engine 28.0.0, so version and actual policy matter even for loopback mappings.
Worked networking scenario
Offline design exercise only. All addresses, topology and observations are fictional; do not contact endpoints, change host networking, create a Swarm or modify firewall rules. A real verification requires an approved disposable environment and documented scope. Keep the exercise offline. For any separately authorized Docker verification, identify the effective endpoint (including DOCKER_HOST and DOCKER_CONTEXT) before sending even read-only Engine requests. Record server version and platform; redact sensitive metadata.
Synthetic NAT mapping (not a command):host 127.0.0.1:18080/tcp -> container 10.77.15.10:8080/tcplistener A: 0.0.0.0:8080 inside containerlistener B: 127.0.0.1:8080 inside containerIn ordinary NAT bridge mode, A can accept traffic forwarded to the container address, while B listens only on its own loopback. A published mapping is not proof of reachability: inspect protocol, binding, route, application health and filtering. A TCP refusal suggests a rejected or absent listener; a timeout alone does not establish a firewall cause. Never use a public probe for this exercise. Distinguish a listener bound to all IPv4 interfaces from one bound to IPv4 loopback; neither establishes IPv6 readiness. For older Engines the loopback publication caveat is a reason to require separate exposure evidence, not to perform an external scan.
Common mistake
Do not open a wider host binding or disable filtering to diagnose a missing listener.
Manual practice
For listener B, write a three-step diagnosis using only hypothetical evidence: inspect mapping, inspect the application listener, then compare the permitted path. State why changing host port alone cannot repair B.
Use the offline worksheet lab-fixtures/docker-advanced-networking/02-nat-forwarding/scenario.txt. No external connectivity or Docker installation is necessary for this task.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
NAT, publishing and reachability — Knowledge check
Interpret network design and diagnostic evidence without live infrastructure.
Which address accepts packets forwarded to the container IP?
What does NAT primarily change?
In the fictional NAT incident, what does a timeout alone establish about the cause?