Compose handles networking by default, creating a single bridge network named <project-name>_default where all services join. Containers discover each other by service name via an internal DNS server, eliminating the need for manual IP configuration. Always reference services by name rather than IP address because Docker assigns dynamic IPs that change upon restart. For host access from containers, use host-gateway or host.docker.internal to resolve the host machine's IP. This resolution is automatic on Mac and Windows. To customize networking, specify custom networks or change the network mode using network_mode: host. You can also map custom hostnames with extra_hosts, driven by environment variables for different targets per environment. The default setup suffices for most development, but fine-grained control is available for complex connectivity needs. Scope: Docker Compose. Reviewed October 4, 2026.
Networking between services
Document v1 · published by Koskamo editorial · updated 2026-10-04
Source and provenance
- Original source
- docs.docker.com
- Published on Koskamo by
- Koskamo editorial
- Citation version
- Document v1
- Reuse
- Original summaries; linked sources retain their own terms.