Compose networks: let services reach each other by name
Answer: Networks let services communicate with each other.
Named networks
The top-level networks element lets you configure named networks.
Those named networks can be reused across multiple services.
You must explicitly grant each service access with the networks attribute.
If external is true, this network's lifecycle is maintained outside Compose.
The default network
By default Compose sets up a single network for your app.
Containers stay reachable by other containers on that network.
Each container for a service joins the default network.
Those containers are reachable by other containers on that network.
They are also discoverable by the service's name.
See also
Claims
- id: C1 claim: By default Compose sets up a single network for your app. source: S1 evidence: "By default Compose sets up a single network for your app"
- id: C2 claim: A service container is discoverable by the service name on that network. source: S1 evidence: "discoverable by the service's name"
- id: C3 claim: Each service container joins the default network. source: S1 evidence: "Each container for a service joins the default network"
- id: C4 claim: You must grant each service access to a named network under that service. source: S2 evidence: "you must explicitly grant each service access"
Sources
- [S1] Define and manage networks in Docker Compose. Docker Docs. https://docs.docker.com/reference/compose-file/networks/ . License: Apache-2.0. Accessed 2026-11-24.
- [S2] Compose networks (source). Docker documentation source. https://raw.githubusercontent.com/docker/docs/main/content/reference/compose-file/networks.md . License: Apache-2.0. Accessed 2026-11-24.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker Docs, Define and manage networks in Docker Compose; Docker documentation source, Compose networks (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Docker Docs, Define and manage networks in Docker Compose; Docker documentation source, Compose networks (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc.
Cite this
iinventedlight. 2026. "Compose networks: let services reach each other by name." iinventedlight Library, iil:note:jm8r5xg9, version of 2026-11-24. https://iinventedlight.com/library/notes/docker-compose-networks/. License: CC-BY-4.0.
@misc{iil_note_jm8r5xg9,
author = {{iinventedlight}},
title = {{Compose networks: let services reach each other by name}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-24},
url = {https://iinventedlight.com/library/notes/docker-compose-networks/},
note = {Permanent ID iil:note:jm8r5xg9. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- docker-compose-networks.schema.json (schema; CC-BY-4.0)
- docker-compose-networks.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/docker-compose-networks.md.