Docker Swarm: simple container orchestration

Simple container orchestration

At SUE, we love containers, and we manage large numbers of them for our customers every day. That’s why we understand better than anyone the importance of good orchestration tools. For medium- to large-scale environments, we recommend Kubernetes without hesitation. On a smaller scale, however, Kubernetes can be too complex. That’s why, in this article, we’ll explore a lesser-known container orchestrator: Docker Swarm.

Docker Swarm

Docker Swarm is a mode of Docker that allows you to transform servers running the Docker Engine into a cluster. Docker Swarm is easy to use (you simply work with the docker command) and is highly integrated with the rest of the Docker ecosystem. This allows you to continue using existing tools such as Docker Compose, Portainer, and Traefik. Thanks to SwarmKit, you can even build your own integrations.

A node within Docker Swarm can serve as either a manager or a worker. Manager nodes make decisions about scheduling and manage the cluster's status using the Raft consensus protocol. Manager nodes can also run containers and store persistent container data. Worker nodes run containers and store container data exclusively; they can only make decisions if you promote them to manager.

With Docker Swarm, you can apply different deployment strategies: as an individual container on a specific node (as with docker run), as a replicated service (where you specify the desired number of replicas), or as a global service (where the container runs on every node in the cluster). In addition, you can use the docker stack command, the Docker Swarm variant of Docker Compose.

Containerized Sea Shanty

As a container orchestrator, the central unit within Docker Swarm is the container. In operational terms, containers are independent software units that can be run (almost) anywhere. It is precisely this self-sufficient nature that makes classic operational tasks, such as updates, a lot easier.

From a technical perspective, containers are not implemented directly by the operating system. Linux provides the building blocks from which containers are constructed, but it is the container engine (such as Docker) that actually implements the container. Containers on Linux are made possible by so-called namespaces and cgroups. Namespaces determine which part of the total system you can see and interact with, while cgroups provide process accounting and restrictions, such as limiting CPU and memory usage. The namespaces used are: Mount (filesystem), Pid (processes), Net (network), IPC (message queues and shared memory), and User (users and groups).

Because namespaces and cgroups are just building blocks, you can build both minimal container engines, such as Chroot, and more advanced solutions such as Containerd or Docker.

A swarm of anecdotes

Docker Swarm is intended for situations where managing individual Docker Engines becomes too cumbersome, but adding Kubernetes introduces too much complexity. For example, when:

  • you have a clearly defined workload that is unlikely to change significantly;

  • your (legacy) application does not require large-scale scalability;

  • you use Docker and Docker Compose;

  • you are looking for an economical container platform;

  • you want to manage your Docker Engines as a single entity.

An important lesson from Kubernetes networking is to use a single cluster-wide network to publish all services. This simplifies communication between services and reduces communication between nodes.

Traefik and Portainer, running on a Swarm manager node, together form an excellent management platform. Thanks to their native support for Docker Swarm, they can automatically detect, manage, and connect containers running within the cluster.

Bind mounts allow you to use node-specific persistent storage, which is especially useful when working with non-uniform storage configurations.

Service discovery functionality makes it possible to always communicate with the correct container, even when multiple instances of the same container are running.

Join the swarm

Do you need advice or support in developing and managing container infrastructure? Our team of experts is happy to help. From setting up the right infrastructure to ongoing support and maintenance.

To learn how SUE sets up and manages Kubernetes clusters, visit the Kubernetes page. The Kubernetes guide covers everything from setting up your first cluster to production.

Stay informed
By subscribing to our newsletter, you declare that you agree with our privacy statement.

Feeling inspired? Get in touch

Michael Veentjer
Michaël Veentjer

Let’s talk


Feeling inspired? Get in touch

* required

By submitting this form, you confirm that you have read and understood our privacy statement.
SUE Cloud Native Solutions
Privacy overview
This website uses cookies. We use cookies to ensure that our website and services function properly, to gain insight into the use of our website, and to improve our products and marketing. For more information, please read our privacy and cookie policy.