|Compose V1/V2||Compose V3|
||replicas in Compose. This function is equivalent to the Replicated Service of swarm mode. When a container malfunctions, a new container will be automatically created to make sure that replicas is equal to the specified number.|
Set the number of containers for a service to scale horizontally. Docker Compose V1/V2 can only start one container in each service. To expand the number of containers, manually set the number after the container is started.
You can use the Container Service expansion label
scale to scale as the container is started.
Moreover, after a container is deleted, you can redeploy the application by completing the following steps:
- Log on to the Container Service console.
- Click Applications in the left-side navigation pane.
- Click Redeploy at the right of the application you want to redeploy. Then, Container Service restarts the container or creates a new container to restore the number of containers to the specified quantity.
This function is equivalent to the Replicated Service (see replicas) of swarm mode. When a container malfunctions, a new container will be automatically created to make sure that replicas is equal to the specified number.
The mode can be configured as Global (one container on each node) or Replicated (specified number of containers). Replicated is configured by default.