depends_on
depends_on
expresses startup and shutdown dependencies between services.
Short syntax
The short syntax variant only specifies service names of the dependencies. Service dependencies cause the following behaviors:
-
Compose creates services in dependency order. In the following example,
db
andredis
are created beforeweb
. -
Compose removes services in dependency order. In the following example,
web
is removed beforedb
andredis
.
Simple example:
services:
web:
build: .
depends_on:
- db
- redis
redis:
image: redis
db:
image: postgres
Compose guarantees dependency services have been started before starting a dependent service. Compose waits for dependency services to be "ready" before starting a dependent service.
Copied from: https://docs.docker.com/compose/compose-file/05-services/#depends_on
标签:Compose,db,redis,depends,services,Docker,before From: https://www.cnblogs.com/zhangzhihui/p/17904937.html