Docker Compose volumes: named persistent stores shared by services
Answer: Compose treats volumes as persistent stores that the container engine implements.
Sharing a named volume
Named volumes are configured in the top-level volumes declaration and may be reused across multiple services.
Each service that needs the volume must be granted access on its own volumes list.
Grant access by using the volumes attribute within the services top-level element.
Creating and configuring them
The docs show a backend and a backup service sharing a volume called db-data.
compose up will create that volume when it is missing.
A bare entry under top-level volumes is enough; the engine then uses its default configuration.
The driver key specifies which volume driver to use, and driver_opts holds driver options.
See also
Claims
- id: C1 claim: Volumes are persistent data stores implemented by the container engine. source: S1 evidence: "persistent data stores implemented by the container engine"
- id: C2 claim: Named volumes can be reused across multiple services. source: S1 evidence: "named volumes that can be reused across multiple services"
- id: C3 claim: You must explicitly grant each service access to a shared volume. source: S2 evidence: "explicitly grant each service access"
- id: C4 claim: An empty top-level volumes entry uses the engine default configuration. source: S2 evidence: "container engine's default configuration"
Sources
- [S1] Compose file reference: volumes. Docker, Inc.. https://docs.docker.com/reference/compose-file/volumes/ . License: Apache-2.0. Accessed 2026-11-24.
- [S2] volumes.md source. Docker, Inc.. https://raw.githubusercontent.com/docker/docs/main/content/reference/compose-file/volumes.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, Inc., Compose file reference: volumes; Docker, Inc., volumes.md 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, Inc., Compose file reference: volumes; Docker, Inc., volumes.md source. Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc.
Cite this
iinventedlight. 2026. "Docker Compose volumes: named persistent stores shared by services." iinventedlight Library, iil:note:ex242xky, version of 2026-11-24. https://iinventedlight.com/library/notes/docker-compose-volumes/. License: CC-BY-4.0.
@misc{iil_note_ex242xky,
author = {{iinventedlight}},
title = {{Docker Compose volumes: named persistent stores shared by services}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-24},
url = {https://iinventedlight.com/library/notes/docker-compose-volumes/},
note = {Permanent ID iil:note:ex242xky. 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-volumes.schema.json (schema; CC-BY-4.0)
- docker-compose-volumes.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-volumes.md.