edit-icon download-icon

scale

Last Updated: Nov 14, 2017

Set the number of containers for a service to scale horizontally.

Currently, Docker Compose 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 scale label to scale as the container is started.

Moreover, after a container is deleted, you can redeploy the application by completing the following steps:

  1. Log on to the Container Service console.
  2. Click Applications in the left-side navigation pane.
  3. 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.

Example:

  1. web:
  2. image: wordpress:4.2
  3. ports:
  4. - 80
  5. links:
  6. - db:mysql
  7. labels:
  8. aliyun.scale: "3"
  9. db:
  10. image: mysql
  11. environment:
  12. - MYSQL_ROOT_PASSWORD=password
Thank you! We've received your feedback.