1. First Principles: What Is Docker Networking?
Docker networking is the system that allows:
- Container ↔ Container communication
- Container ↔ Host communication
- External ↔ Container communication
- Network isolation between groups of containers
Under the hood, Docker uses:
- Linux network namespaces
- Virtual ethernet interfaces (Veth pairs)
- Linux bridges
- iptables rules
Every container gets its own network namespace (isolated network stack).
2. What Happens When You Run Docker Compose
When you run:
docker compose up
Docker Compose automatically:
-
Creates a bridge network:
<project_name>_default
-
Connects all services to it.