How does Docker handle outbound traffic from a container to the internet?

AdvancedConceptNetworking
Answer

Packets leave via eth0 to the bridge, the host forwards them (needs net.ipv4.ip_forward=1, which Docker enables), and an iptables MASQUERADE rule rewrites the source to the host IP. If forwarding is disabled or a firewall drops FORWARD, containers cannot reach out and DNS lookups time out.

All Docker questions Roadmap: Docker & containers

More on Networking