Docker Swarm
Now that we have discussed how to launch individual Docker instances using Docker Machine, let's get a little more adventurous and create a cluster of instances. To do this, Docker ships a tool called Swarm. When deployed, it acts as a scheduler between your Docker client and host Docker instances, deciding where to launch containers based on scheduling rules.
Creating a local cluster
To start off, we are going to be using Docker Machine to create a cluster locally using VirtualBox (https://www.virtualbox.org), which is bundled with Docker Toolbox. To start, we are going to launch a VM to generate a discovery token. To do this, run the following commands:
docker-machine create -d virtualbox discover
Then configure your Docker client to use the newly created local instance:
eval "$(docker-machine env discover)"
You can check that your Docker client is configured to use the discover
instance by running docker-machine ls
and making sure that discover
has a star in the...