Join David Davis for an in-depth discussion in this video Introducing Docker Swarm, part of Docker Essential Training: 2 Orchestration.
- [Instructor] Docker Swarm is the cluster management and orchestration feature built into Docker Engine. Docker Swarm is available whether or not you have Docker Community Edition or Enterprise Edition. The Docker Swarm functionality comes from a separate project that Docker calls Swarmkit. A swarm cluster of Docker hosts or nodes, as they're called, is a highly available cluster of servers that runs in swarm mode. What's so powerful about Docker Swarm is that you can create what they call a service.
For example, we could have a web server service with tens or even hundreds of web servers and define its desired state. For example, you could say that you want port 80 exposed for all the web servers, you could define the storage that all the web servers need and you could say that you always want to have, for example, 100 web servers running. Docker Swarm can take that service definition and act on it to ensure that it's always available. For example, here on our diagram, if we had one worker node fail, all the web servers that were defined as part of the service would be automatically moved over to other worker nodes in the Docker swarm cluster to ensure that the service always stays highly available and that all of the web servers that you define remain running at all times.
The swarm cluster is run by what we call managers and the work is done by worker nodes, which run the swarm services. The core features of Docker Swarm are high availability, ensuring that your applications and services are always available. Load balancing, so that the load is distributed across all of the containers running in the cluster. Resiliency, so that if something unexpected happens in the cluster, those applications remain always available. Placement, so that when new workloads are added, they're automatically distributed across the cluster.
And, as I described, the declarative service model, so that you can declare what applications you want running and ensure that those are always distributed and highly available in the Docker swarm cluster. Docker Swarm is also secure by default. Each node in the swarm cluster has encrypted communications with all the other nodes and rolling updates are possible, so that if you need to upgrade the Docker software on a particular node, all the workloads can be automatically moved to other nodes in the cluster.
So what's the business benefit to orchestration? The Docker container philosophy is to break large applications up into much smaller microservices. With those containerized microservices, Docker Swarm helps you to ensure that you have consistent performance and high availability so that, if the unexpected happens or if you need to massively scale up your applications, you'll maintain consistent performance and availability for your end users.
- Setting up a Docker Swarm cluster
- Locking a Swarm cluster
- Why Quorum is important
- Visualizing Swarm services
- Analyzing services with Docker Inspect
- Troubleshooting a service
- Using templates with Docker services