Skip to content

Compose's include directive splits a setup across several files

August 21, 2024

Docker Compose has an include directive that lets you split your setup into multiple files, as the data anonymisation tool Neosync does in its compose file:

# compose.yml
include:
  - path: ./compose/temporal/compose.yml
    env_file:
      - ./compose/temporal/.env
  - path: ./compose/compose-db.yml

services:
  app:
    depends_on:
      - db
      - temporal

Each included file is resolved relative to its own directory, so paths inside it just work. You can then reference the included services directly, in depends_on or over the network. Includes work recursively, too.

—

Back to TIL

Next: GitLab CI's variables block does not expand other variables, so a default goes in before_script

Phil-Bastian Berndt

Phil-Bastian Berndt
Tech Lead at Naymspace