Explain Docker networking modes.
Assesses fundamental understanding of Docker conventions, runtime behavior, and memory/performance considerations.
Hiring managers look for precision, avoidance of ambiguous jargon, and ability to explain trade-offs under real production conditions.
Docker creates network namespaces and connects containers using drivers.
- bridge (default): containers get private IPs on a virtual bridge. Same-network containers resolve each other by name, and external access needs port publishing. User-defined bridges provide automatic DNS.
- host: the container shares the host network stack, so there is no isolation and no port mapping. Best performance, but port conflicts are possible.
- none: no networking except loopback.
- overlay: spans multiple Docker hosts for Swarm services.
- macvlan: assigns a MAC address so containers appear as physical devices on the LAN.
docker network create app-net
docker run -d --network app-net --name api api:1.0
docker run -d --network app-net --name web web:1.0
Prefer user-defined bridge networks over the default bridge for service discovery, and use host mode only when you need raw performance or non-HTTP protocols.
Candidate Response Strategy & Interview Tips
- Start with a concise one-sentence summary: Deliver a direct, confident answer first before expanding into nuances.
- Demonstrate real-world trade-offs: Discuss where this approach excels and when you would avoid it in production systems.
- Discuss complexity & edge cases: Proactively explain time/space complexity or boundary conditions (null values, scale limits).
- Prepare for interviewer follow-ups: Technical hiring panels frequently probe deeper into concurrency, backward compatibility, or alternative libraries.