Many teams outgrow a single Docker host but do not want the complexity of Kubernetes. Swarm mode fills that gap: it uses the same Docker CLI and Compose file format teams already know, adds multi-node scheduling, service discovery, rolling updates and secrets, and runs comfortably on a few VPS servers. Swarm mode remains part of Docker Engine, though it receives fewer new features than Kubernetes, so check that it covers your needs before committing.
Key Concepts
- Managers store cluster state with the Raft consensus algorithm and schedule tasks; they can also run services.
- Workers run tasks assigned by managers.
- Services describe the desired state: image, replicas, networks, update policy.
- Stacks group services defined in a Compose file and deployed together.
Managers and Quorum
A swarm keeps working while a majority of managers is available. With three managers, it survives one failure; with five, it survives two. Two managers tolerate no failures, so they offer no advantage over one. Most small clusters use three managers. Spread them across different hosts, and keep regular backups of the manager state in case quorum is lost.
Setting Up
docker swarm init --advertise-addr <private-ip>
docker swarm join-token manager # prints command to add managers
docker swarm join-token worker # prints command to add workers
docker node ls
Advertise private IP addresses so cluster traffic stays off the public interface. The cluster uses TCP 2377 for management, TCP and UDP 7946 for node communication, and UDP 4789 for overlay network traffic. Allow these only between cluster nodes in the firewall. Keep join tokens secret and rotate them if they leak.
Deploying Stacks
Write services in a Compose file with a deploy section for replicas, placement, resources and update policy, then run docker stack deploy -c stack.yml app. Note that some Compose options used for single hosts (such as build) are ignored in stack deployments, so build images in CI and push them to a registry first (see our private registry guide). Use --with-registry-auth when images are private.
Overlay Networks and Ingress
Overlay networks connect containers across nodes, with service names resolving through built-in DNS. Create separate networks for frontends and backends so databases are not reachable from everything. Overlay traffic can be encrypted with the encrypted option at some performance cost. Published ports use the routing mesh by default, so a port published on the swarm is reachable on every node and forwarded to a healthy task.
Reverse Proxy and TLS
Run Traefik or Nginx as a service on manager or edge nodes, terminating HTTPS and routing by hostname to services on an overlay network. Traefik can discover Swarm services through labels and obtain Let's Encrypt certificates automatically; if you run more than one replica, store certificates in a way all replicas can use, or keep a single replica with fast restart. Point DNS at the edge nodes or a floating IP.
Secrets and Configs
Swarm secrets are stored encrypted in the Raft log and mounted into containers as files under /run/secrets, only for services that request them. Use them for database passwords and API keys instead of environment variables in Compose files. Configs work the same way for non-sensitive configuration files. Secrets are immutable, so rotate by creating a new secret and updating the service.
Rolling Updates and Rollbacks
- Set
update_configwithparallelism,delayandorder: start-firstfor zero-downtime updates where possible. - Define health checks so Swarm waits for new tasks to be healthy.
- Set
failure_action: rollbackto revert automatically when updates fail. - Deploy immutable image tags so rollbacks are predictable.
Our zero-downtime deployment guide explains the underlying ideas.
Stateful Services
Swarm volumes are local to each node by default. Pin databases and other stateful services to a specific node with placement constraints on node labels, so they always restart where their data lives, or run databases on separate VPS servers outside the swarm. Shared storage drivers exist but add complexity and failure modes; test carefully before relying on them.
Backups
Back up the swarm state from /var/lib/docker/swarm on a manager (with Docker stopped on that manager, or following Docker's documented procedure) along with the unlock key if autolock is enabled. Keep stack files in Git so services can be recreated, and back up volume data and databases with application-aware tools.
Monitoring
Watch node availability, service replica counts against desired counts, task restarts, resource use per node and container, and certificate expiry. Prometheus with node exporter and cAdvisor, plus Grafana dashboards, is a common stack; see our monitoring guide.
Sizing
| Cluster | Suggested plans |
|---|---|
| Small HA cluster, managers run services | 3 × 2 vCores / 8 GB |
| Managers plus dedicated workers | 3 × 2 vCores / 8 GB managers, 4–8 vCore workers |
| Busy applications with many replicas | Several 8 vCore / 32 GB workers |
Keep enough spare capacity that the remaining nodes can run all replicas if one node fails.
Swarm or K3s?
Swarm is easier to learn and operate, and Compose files carry over directly. K3s offers the wider Kubernetes ecosystem: Helm charts, operators, GitOps tools and more advanced scheduling. Small teams with a few services often start with Swarm; teams expecting many services or needing Kubernetes tooling choose K3s (see our K3s production guide).
Common Mistakes
- Two managers, which cannot tolerate any failure.
- Exposing cluster ports to the internet.
- Passwords in Compose environment variables instead of secrets.
- Stateful services that move to a node without their data.
- No health checks, so broken updates roll out fully.
In Short
Use three managers, keep cluster traffic private, deploy stacks from Compose files with images from a registry, use secrets, configure health-checked rolling updates, pin stateful services, back up state and volumes, and monitor replicas.
SkyRainCloud Plans for This Workload
Swarm adds almost no overhead. Three 2 vCore / 8 GB managers that also run light services make a resilient small cluster; add 4 or 8 vCore workers for heavier applications.
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Intel Xeon Platinum 8269CY VPS
KVM VPS on Intel Xeon Platinum 8269CY (up to 3.80 GHz Turbo) with DDR4 ECC memory, NVMe SSD, full root access and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — Intel | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Business websites, small apps, scheduled jobs and bots | Order |
| VPS 2 — Intel | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,169/month | Business software, mid-size databases, several sites on one server | Check stock |
| VPS 3 — Intel | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,249/month | ERP/CRM stacks, heavier databases, multiple production apps | Check stock |
| VPS 4 — Intel | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,299/month | High-memory workloads and consolidated production servers | Check stock |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.