"Life is all about sharing. If we are good at something, pass it on." - Mary Berry

condition form of depends_on in docker-compose version 3

visitor badge


Categories: DevOps

As version 3 no longer supports the condition form of depends_on, what is the alternative way to wait for a container to be started completely?

From 1.27.0, 2.x and 3.x are merged with COMPOSE_SPEC schema.

version is now optional. So, you can just remove it and specify a condition as before:

 2  web:
 3    build: .
 4    depends_on:
 5      redis:
 6        condition: service_healthy
 7  redis:
 8    image: redis
 9    healthcheck:
10      test: ["CMD", "redis-cli", "ping"]
11      interval: 1s
12      timeout: 3s
13      retries: 30

Tags: docker-compose healthcheck docker

Edit on GitHub

Related Posts: