Today, I will show you how to scale Docker compose applications using the built-in scale option that is integrated into compose.
About Docker Compose
Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file to configure the application’s services.
Once the file Is created I can start all the services using a single command.
Below you can see that I have a deployed application running a single container.
Docker -compose ps
Using the build in —scale switch that is part of the docker-compose command line I will scale the application to two containers as you can see below.
Note: make sure you use the application name specified in the docker-compose file.
docker-compose up -d --scale webserver1=2
After I run the scale command I will issue the docker-compose ps command and as you can see now I have two containers powering my application
Using compose to scale application is very efficient and can be done on the fly in a matter of seconds because of the build in functionality of the product.