Template version
Compose V1/V2 | Compose V3 |
---|---|
The aliyun.depends label. |
depends_on in Compose. The system starts services in dependency order. By default, the system waits for 3 minutes for a service to start. If the service fails to start within 3 minutes, the system will ignore this service and move on to deploy another service. However, the whole deployment fails. |
Compose V1/V2
Set the dependencies of a service.
After setting the dependencies of a service, Container Service can control the start sequence of containers, starting the containers one by one.
Orchestration example:
Note: Separate dependencies by using commas (,).
web:
image: wordpress:4.2
ports:
- 80
links:
- db:mysql
labels:
aliyun.depends: db,redis
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=password
redis:
image: redis
Compose V3
Set the dependencies of a service.
The system starts services in dependency order. By default, the system waits for 3 minutes for a service to start. If the service fails to start within 3 minutes, the system will ignore this service and move on to deploy another service. However, the whole deployment fails.
Orchestration example:
version: '3'
services:
web:
build: .
depends_on:
- db
- redis
redis:
image: redis
db:
image: postgres