← All notes

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

Sources

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

Permanent ID: iil:note:ex242xky

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.},
}

Markdown

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.

All artifact files (JSON index)

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.