Docker Compose - Additional property include is not allowed

Kent - August 18, 2023

I was about to clean up some docker-compose.yml files, when I found out it is possible to include other files.

But then I got (root) Additional property include is not allowed.

$ docker-compose pull
(root) Additional property include is not allowed

For once, the solution is simple. It’s a new feature in docker-compose version 2.20 dated 11th of July 2023.

It allows include in docker-compose.yml.

include:
  - ../commons/compose.yaml
  - ../another-project/compose.yaml

services:
  foo:
    depends_on:
      - imported-service

For OpenSUSE Tumbleweed and any other rolling distro, it’s as simple as upgrading to the latest version of docker-compose.

This is an alternative to using profile donotstart on a service.

services:
  foo:
    profiles:
      - donotstart

Comment out a service if it’s not needed:

include:
  - ../commons/compose.yaml
  - ../another-project/compose.yaml
  # - temporary-service.yaml

services:
  foo:
    depends_on:
      - imported-service

See Also

Comments

Any comments? Create a new discussion on GitHub.
There used to be an inline comment form here, but it was removed.