Docker - Scale (Number of container for a service)

Card Puncher Data Processing

About

Scale sets the number of containers to run for a service.

Management

Command line

# Use the up command with the --scale flag instead. - Scale SERVICE to NUM instances.
# docker-compose up --scale SERVICE=NUM        
docker-compose up --scale web=2 worker=3
# deprecated
docker-compose scale web=2 worker=3

It will overrides the scale setting in the Compose file if present.

docker-compose.yml

Added in version 2.2 file format. Version 2

web:
  image: busybox:latest
  command: echo 'scaled'
  scale: 3

Documentation / Reference







Share this page:
Follow us:
Task Runner