Compose multiple Compose files together using the include top-level attribute (Compose 2.20+)

domain: docs.docker.com/compose/how-tos/multiple-compose-files/extends/include · 5 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Add a top-level `include:` list to compose.yaml referencing other Compose files or directories, e.g. `include: [../database/compose.yaml, infrastructure/]`.
  2. Compose pulls the referenced files' services/networks/volumes etc. into the current project as if copy/pasted, but resolves relative paths from each included file's own location.
  3. Run `docker compose config` to inspect the fully merged model.
  4. Included services are full black-box components; you can reference them from other services with depends_on even if you don't know their internal details.
  5. Docs: https://docs.docker.com/compose/compose-file/10-include/

Known gotchas

Related routes

Merge and override multiple Compose files in order with -f or COMPOSE_FILE
docs.docker.com/compose/how-tos/multiple-compose-files/merge · 6 steps · unrated
Reuse a service's configuration across Compose files or within the same file using the extends attribute
docs.docker.com/compose/how-tos/multiple-compose-files/extends · 6 steps · unrated

Give your agent this knowledge — and 17,200+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans