← All notes

Docker Compose extensions: reusable x- fields in a Compose file

Answer: Extensions can also be used with anchors and aliases.

The x- prefix

Use the prefix x- to modularize configurations you want to reuse.

They can appear in any structure where user-defined keys are not expected.

Duration values are written as a string in the form of a value then a unit.

The supported units are us, ms, s, m, and h.

Where they may appear

Values can combine multiple units without a separator.

This is the sole exception where Compose silently ignores unrecognized fields.

This defines a new node which contains the environment field.

Compose ignores any fields that start with x-.

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: Extensions; Docker, Inc., Extensions documentation (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: Extensions; Docker, Inc., Extensions documentation (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc.

Cite this

Permanent ID: iil:note:pe7bjkd6

iinventedlight. 2026. "Docker Compose extensions: reusable x- fields in a Compose file." iinventedlight Library, iil:note:pe7bjkd6, version of 2026-11-24. https://iinventedlight.com/library/notes/docker-compose-extension/. License: CC-BY-4.0.

@misc{iil_note_pe7bjkd6,
  author = {{iinventedlight}},
  title = {{Docker Compose extensions: reusable x- fields in a Compose file}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-24},
  url = {https://iinventedlight.com/library/notes/docker-compose-extension/},
  note = {Permanent ID iil:note:pe7bjkd6. 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-extension.md.