Scaling a service: three api containers
Select an icon to see what it is.
Step 1 of 6
--scale creates numbered replicas
docker compose up -d --scale api=3 creates three containers from the one api service. They are named shop-api-1, -2 and -3, and carry a com.docker.compose.container-number label. Each one is a separate container with its own process.
$ docker compose up -d --scale api=3 PrevNext
POST /v1.45/containers/create?name=shop-api-2
{"Image": "traefik/whoami""Labels": {"com.docker.compose.service": "api""com.docker.compose.container-number": "2"}}