Search code examples
dockerdocker-compose

How to make a service in docker compose depends_on all other services?


I have a docker-compose.yml describing many services and I want to make sure that one of them starts in last but I don't want to precise depends_on for every other service in the compose file.

Basically I would like a flag looking like this

depends_on:
 - all_services

Can it be done in a docker compose file?


Solution

  • Compose doesn't have any syntax like this. Also see the Compose Specification definition of depends_on:. You need to explicitly list out all of the services you depend on (and their conditions, if the dependency is anything more than "the container exists").