What is a Docker network? How do containers reach each other by name, and which network types exist?
Short answer
Every container has its own network namespace; containers on the same network call each other directly, and on a user-defined network they can call by name thanks to Docker's internal DNS. Common drivers: bridge (one host), host, none, overlay (many hosts).
3 points to say:
- The default bridge only allows calls by IP; a user-defined bridge has name-based DNS and isolates by network.
localhostinside a container is the container itself, not the host; containers on one network use the original port, no-pneeded.- host uses the machine's network directly, none has no network, overlay spans hosts; Kubernetes uses CNI, not Docker networks.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.