Docker Compose Service Networking
Compose creates a user-defined bridge per project and attaches every service to it, so services reach each other as 'db:5432' or 'api:8000' using service names as DNS hostnames — no published ports needed for container-to-container traffic. Ports are published only for traffic entering from the host, a distinction that resolves most 'connection refused' confusion in Compose.
This Concept is waiting for its first lesson!
Compose creates a user-defined bridge per project and attaches every service to it, so services reach each other as 'db:5432' or 'api:8000' using service names as DNS hostnames — no published ports needed for container-to-container traffic. Ports are published only for traffic entering from the host, a distinction that resolves most 'connection refused' confusion in Compose.
Are you a teacher? Sign in to start contributing.
Sign In