It's a well-known fact that deploying and managing anything at scale is hard. Docker is no different. However, the engineers at Docker recognize this and are working on three products to help: Docker Machine, Docker Compose, and Docker Swarm.
At the highest level, Machine makes it easy to spin up Docker hosts in your environment, Compose makes it easier to deploy complex distributed apps on Docker, and Swarm enables native clustering for Docker.
All of these are new technologies and currently under development at Docker Inc. All are pluggable, meaning they're optional and can be swapped out in favor of third-party products that do the same job. This follows the Docker philosophy of "batteries included but removable." If you find a third-party tool that works better for you, you're free to use it to drive Docker instead.
In this article, we'll take a quick look at Docker Swarm.
What is Docker Swarm?
If Swarm is native clustering for Docker, we need to define "clustering." In the context of Swarm, a cluster is a pool of Docker hosts that acts a bit like a single large Docker host. Instead of the hassle of having to decide which host to start every container on, we can tell Swarm to start our containers. In the background, Swarm magically decides which nodes to start them on. This is a great feature and a core tenet of cloud computing.
But for readers familiar with conventional fail-over clustering, Swarm is not that — yet.
At the time of writing (version 0.2), Swarm does not support container fail-over. This means that when a node in the cluster fails, the containers it was hosting will not be restarted on another node.
This is probably the biggest weakness in the current version of Swarm. Now that you know what a Swarm cluster effectively is, let's look at some of the good things it currently offers.
Swarm is easy
There's a lot to like about Swarm. First and foremost, it's easy. Compared to clustering technologies I've worked with in the past, Swarm is an absolute walk in the park. Building a Swarm cluster is basically the following three simple steps:
Each of the above steps is done with a single command: one command to create the cluster definition, another to add hosts to the cluster, and another to create a cluster manager. That's it!
Note that the command to join hosts to the cluster has to be run on each host joining the cluster. Once hosts are joined to the cluster, they are referred to as nodes.
You already know Swarm
Once your Swarm cluster is up and running, you'll feel right at home with it. Swarm clusters look, smell, and feel like normal Docker. If you know Docker, you know Swarm. This is because Swarm is mostly compatible with the Docker Remote API.
Sign up for CIO Asia eNewsletters.