Docker & Containers (50 Qs)•Part 3: Advanced Internals, Scale & Production Security (Senior / Lead)
Container Networking Modes: Bridge, Host, Overlay, and Macvlan.
senior LevelSecurity & AuthDocker & Containers
In Simple Words:
- Bridge (Default
bridge): Creates a virtual bridge (docker0) on host with NAT port mapping (-p 8080:80). Isolated private IP network. - Host (
--network host): Bypasses network isolation. Container attaches directly to the host's network stack with zero NAT overhead (maximum packet throughput). - Overlay: Multi-host networking spanning across multiple physical Docker hosts (powers Docker Swarm and Kubernetes Pod networks).
- Macvlan: Assigns a real MAC address to the container, making it appear as a physical hardware device on the LAN router.