What is Docker Swarm:
Docker Swarm is the orchestration tool from the makers of Docker. In the words of Docker website itself, “Docker Swarm provides native clustering capabilities to turn a group of Docker engines into a single, virtual Docker Engine.”
In case you are unfamiliar with what Docker is, you can read my previous post about “Setting up/migrating your WordPress website on Docker”
Here are few reasons for considering docker swarm as your orchestration tool.
- Simple setup process: Docker Swarm is pretty easy to set up and run. You need to bring up a discovery backend
- Follows Unix Philosophy: Do one thing and do it well. This one is more of a Docker features for all its services (Including Docker, Docker machine, Docker compose, etc.)
- Docker Compose integration: If you are planning to use Docker Compose with your cluster to bring up the nodes, you can use the compose files without any change in them.
- Support for a plethora of service discovery methods: The Docker Swarm cluster consists of a Swarm Discovery backend, Swarm Manager, and Swarm Nodes. The Nodes and Manager register themselves with the Discovery backend. Docker Swarm supports various types of service discovery options such as Token, Consul, etcd and zookeeper for service discovery.
- Provides Manager failover with Multi-master setup: The Swarm manager is responsible for management of the whole cluster. So it is very important that you make this master redundant. If the master fails, the whole cluster will be down.
- Supports all machines: The Nodes that work in the Swarm cluster setup can be anything ranging from a physical machine, a virtual machine or any cloud instance.
- Compatible with Docker API: Docker Swarm can be fully integrated with Docker services. The Docker API is integrated into Swarm so that all other Docker tools can be used with Docker Swarm.
- Container autostart: Docker Swarm supports container autostarting in case any container goes down.
- Load balancing with Docker Swarm: The Docker Swarm, for now, does not have load balancing integrated into it. You need to use external load balancers such as Nginx or HAProxy to load balance Swarm cluster applications.
- Automated backups: There is no provisioning for automated backups with Swarm itself. All the containers need to be backed up either via script or manually.
- Autoscaling of containers: Docker Swarm does not provide any built-in option for autoscaling Docker containers when resource usage goes high.
Despite its limitations, Docker Swarm remains one of the favourite tools for orchestration. If you are planning to move your production infrastructure to Docker swarm, you can read about building the Docker Swarm cluster for production here.