|Compose V1/V2||Compose V3|
|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.|
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.
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.
parallelism label defines how many containers that
rolling_updates can concurrently update at a time.
Note: This label must be used with the
- 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
parallelismlabel) 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
parallelismvalue is less than the number of containers in the service.
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.
Configure how to update the services.
- 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.