edit-icon download-icon

depends

Last Updated: Feb 12, 2018

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 (,).

  1. web:
  2. image: wordpress:4.2
  3. ports:
  4. - 80
  5. links:
  6. - db:mysql
  7. labels:
  8. aliyun.depends: db,redis
  9. db:
  10. image: mysql
  11. environment:
  12. - MYSQL_ROOT_PASSWORD=password
  13. redis:
  14. 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:

  1. version: '3'
  2. services:
  3. web:
  4. build: .
  5. depends_on:
  6. - db
  7. - redis
  8. redis:
  9. image: redis
  10. db:
  11. image: postgres
Thank you! We've received your feedback.