According to docker-compose issue #5586, scale
is deprecated. The replacement is deploy.replicas
but that latter is not handled by docker-compose
, only by docker stack
implying you have to run Docker in swarm mode.
As alternate solutions, you can scale services from the command line with docker-compose:
docker-compose up --scale app=3
I'm not too fond of this solution since in my understanding docker-compose.yml
is supposed to be self-contained and should not depend on command line options.
Another option is to run docker-compose in --compatibility
mode:
docker-compose --compatibility up
In that case, docker-compose
will translate some deploy
entries into their version 2 equivalent. But because of the name of that option, and because of the warnings in the docs, it does not look like a mid- to long-term solution.
What would you suggest to replace the docker-compose v2 scale
option?