Skip to content

How -p 8080:80 reaches your container

Select an icon to see what it is.

Step 5 of 6

PREROUTING rewrites the destination

In the nat PREROUTING chain, a rule sends traffic for local addresses to the DOCKER chain, where the DNAT rule matches. The kernel changes the destination to 172.18.0.2:80 and records the change in conntrack. It then forwards the packet through the shop-net bridge to web.

nat PREROUTING

-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
DOCKER: dpt:8080 -> DNAT to 172.18.0.2:80