All Products
Document Center


Last Updated: Feb 12, 2018

Template version

Compose V1/V2 Compose V3
The aliyun.rolling_updates label.
The aliyun.rolling_updates.parallelism label.
update_config in Compose. This is a native function of swarm mode. You can configure the number of containers updated in parallel each time, the update interval, and the action after the failure.

Compose V1/V2


During a service update, if the service includes more than one container (defined by the scale label), the (N+1)th container is updated after the Nth container is successfully updated. In this way, the service downtime is minimized.

Orchestration example:

Deploy the WordPress service. Specify to deploy 2 containers by using the scale label. Use the rolling_updates label to minimize the service downtime for WordPress.

  1. web:
  2. image: wordpress
  3. ports:
  4. - 80
  5. restart: always
  6. links:
  7. - 'db:mysql'
  8. labels:
  9. aliyun.logs: /var/log
  10. aliyun.routing.port_80: http://wordpress
  11. aliyun.rolling_updates: 'true'
  12. aliyun.scale: '2'
  13. db:
  14. image: mariadb
  15. environment:
  16. MYSQL_ROOT_PASSWORD: example
  17. restart: always
  18. labels:
  19. aliyun.logs: /var/log/mysql


The parallelism label defines how many containers that rolling_updates can concurrently update at a time.

Note: This label must be used with the rolling_updates label.

parallelism value:

  • The default value is 1, namely, updating one container at a time.
  • When the value is greater than 1, during rolling_updates, a certain number (defined by the parallelism label) of containers are concurrently updated at a time to realize the batch update.
  • When the value is invalid, the default value 1 is used.

    Note: To make sure that at least one container is providing service, we recommend that the defined parallelism value is less than the number of containers in the service.

Orchestration example:

Deploy the Nginx service. Specify to deploy four containers by using the scale label. Use the rolling_updates label and parallelism label to define that two containers are updated in batch at a time.

  1. web:
  2. image: nginx:latest
  3. restart: always
  4. environment:
  5. - "reschedule:on-node-failure"
  6. ports:
  7. - 80
  8. labels:
  9. aliyun.scale: "4"
  10. aliyun.rolling_updates: 'true'
  11. aliyun.rolling_updates.parallelism: "2"

Compose V3

Configure how to update the services.

Field explanation:

  • parallelism: The number of containers updated concurrently at a time.
  • delay: The time interval between updating different groups of containers.
  • failure_action: The system action after an update fails. The value can be continue (continue to update the next batch of containers after the failure), rollback (roll back to the status before the update), or pause (stop updating the services after the failure). The default value is pause.
  • monitor: The monitoring duration for checking whether or not the update fails after the update is finished. The unit can be ns, us, ms, s, m, and h. The default value is 0s. The system checks whether or not the update fails immediately after the update is finished.
  • max_failure_ratio: The allowed failure ratio for each update.

Orchestration example:

  1. version: '3'
  2. services:
  3. vote:
  4. image: wordpress:4
  5. depends_on:
  6. - mysql
  7. deploy:
  8. replicas: 2
  9. update_config:
  10. parallelism: 2
  11. delay: 10s