Setting up a Swarm cluster
We'll continue using Docker Machine since it provides a very convenient way to simulate a cluster on a laptop. Three servers should be enough to demonstrate some of the key features of a Swarm cluster:
Note
All the commands from this chapter are available in the 02-docker-swarm.sh
 (https://gist.github.com/vfarcic/750fc4117bad9d8619004081af171896) Gist
for i in123; do
docker-machine create -d virtualbox node-$i
done
At this moment, we have three nodes. Please note that those servers are not running anything but Docker Engine.
We can see the status of the nodes by executing the following ls
command:
docker-machine ls
Â
The output is as follows (ERROR column removed for brievity):
NAME ACTIVE DRIVER STATE URL SWARM DOCKER
node-1 - virtualbox Running tcp://192.168.99.100:2376 v1.12.1
node-2 - virtualbox Running tcp://192.168.99.101:2376 v1.12.1
node-3 - virtualbox Running tcp://192.168.99.102:2376 v1.12.1
Figure 2-5: Machines running Docker...