Container networking
Published port
A host port forwarded to a container's port with a DNAT rule, so others reach a container through its host.
A published port is a host port forwarded to a port inside a container. Containers sit on a private bridge network behind their host's NAT: they reach out, nobody reaches in. docker run -p 8080:80
publishes one: the host gets a DNAT rule sending its port 8080 to the container's port 80, the same rewrite as a
home router's port forward. -p 127.0.0.1:8080:80 publishes to the host alone.
Read next
- Port forward One port on the router's public address passed to one device and port inside.
- Network namespace A separate copy of the kernel's network: its own cards, addresses, routes and firewall, which is what a container's network is.
- NAT A router rewriting addresses as packets pass, usually to hide many private devices behind one address.