Working with Docker Swarm
The previous section of this chapter has shown you that Swarm uses similar concepts to what you have already learned so far in this book. You'll see that the use of Swarm takes the Docker commands you are so familiar with and expands them to allow you to create your clusters, manage services, and configure your nodes. Docker Swarm takes a lot of the hard work out of running your services, as Swarm will work out where it is best to place your services, take care of scheduling your containers, and decide which node it is best to place it on. For example, if there are already three services running on one node and only one service on your second node, Swarm will know that it should distribute the services evenly across your system.
By default, Docker Swarm is disabled, so to run Docker in swarm mode, you will need to either join an existing cluster or create a new swarm. To create a new swarm and activate it in your system, you use the swarm init
command...