Scaling up with Docker Swarm

Docker Swarm is Docker's orchestrating layer to manage the containers. It is a cluster management tool that focuses on creating replicas of your services, networks, as well as storage resources available to it and managing them.

The Docker Swarm is nothing more than a cluster of Docker nodes. They act as a manager or worker. One interesting feature to note is that a Docker container inside the Swarm can either be a manager or worker or both. This helps the swarm to allocate a new manager when the manager nodes go down. 

At a high level, the manager nodes are responsible for cluster management tasks and execute containers. The workers are responsible for executing the containers only.

JHipster applications give us the flexibility to scale our entire application with a single command, with JHipster's docker-compose sub-generator:

> docker-compose scale <app-name>=<scale to>

Now we can scale the instances, using the following command:

> docker-compose scale invoice-app=2

The preceding command will spin another invoice instance and we can see it on the dashboard, as follows: