Docker Swarm vs Kubernetes for Self-Hosting
Quick Verdict
Neither Docker Swarm nor Kubernetes is necessary for most self-hosters. Docker Compose on a single node covers 95% of homelab workloads. If you genuinely need multi-node container orchestration — high availability, automatic failover, rolling deployments across machines — Docker Swarm is dramatically simpler to set up and operate. Kubernetes is overkill for homelab use unless you’re running 10+ nodes or need K8s experience for your career. Don’t add orchestration complexity you don’t need.
Overview
Docker Swarm is Docker’s built-in orchestration mode. Run docker swarm init on any machine with Docker installed and you have a single-node Swarm cluster. Join additional nodes with a token. Deploy services using Compose files with docker stack deploy. Swarm handles scheduling, service discovery, load balancing, and rolling updates across the cluster. It has been part of Docker Engine since 2016.
Kubernetes (K8s) is the industry-standard container orchestrator, originally designed by Google and now maintained by the Cloud Native Computing Foundation (CNCF). It manages containers across clusters of machines with a declarative API, sophisticated scheduling, and an enormous ecosystem of add-ons. Kubernetes powers most production cloud infrastructure and has become the de facto platform for running containers at scale.
Both tools solve the same core problem: running containers across multiple machines with automated scheduling, networking, and failover. The difference is scope and complexity. Swarm is a simple orchestration layer bolted onto Docker. Kubernetes is a full platform that replaces most of your infrastructure stack.
Feature Comparison
| Feature | Docker Swarm | Kubernetes |
|---|---|---|
| Setup complexity | docker swarm init — one command | Multiple components (API server, etcd, scheduler, controller-manager, kubelet, kube-proxy); simplified with k3s/microk8s |
| Learning curve | Low — uses Docker Compose syntax, familiar CLI | Steep — new abstractions (Pods, Deployments, Services, Ingress, ConfigMaps, Secrets, PVCs) |
| Resource overhead (control plane) | ~50 MB RAM for the manager | 2+ GB RAM minimum for standard K8s; ~512 MB with k3s |
| Multi-node support | Yes — join workers with a token | Yes — join workers via kubeadm, k3s agent, or cloud provider |
| Service discovery | Built-in DNS for services | Built-in DNS via CoreDNS |
| Load balancing | Built-in ingress routing mesh | Requires an Ingress controller (Traefik, Nginx Ingress, etc.) |
| Rolling updates | Built-in, simple configuration | Built-in, highly configurable (surge, unavailability, rollback) |
| Secret management | Built-in, encrypted at rest | Built-in, base64-encoded by default (encrypt with additional config) |
| Storage orchestration | Docker volumes only | Persistent Volumes, Storage Classes, CSI drivers — full storage abstraction |
| Networking model | Overlay network with routing mesh | CNI plugins (Flannel, Calico, Cilium) — more flexible, more complex |
| Monitoring | Basic docker service ls and docker stats | Rich ecosystem (Prometheus, Grafana, metrics-server built-in) |
| Community size | Small, declining | Massive — CNCF flagship project |
| Cloud provider support | Minimal — no major cloud offers managed Swarm | Universal — EKS, GKE, AKS, and dozens more |
| Self-hosting suitability | Good for 2-5 node homelabs | Overkill for most homelabs; valuable for learning |
| Development status | Maintenance mode — no major features since 2019 | Very active — multiple releases per year, huge contributor base |
Installation Complexity
This is where the two diverge most dramatically.
Docker Swarm
If Docker is installed, you are one command away from a Swarm cluster:
docker swarm init
That’s it. Your machine is now a Swarm manager. To add a worker node:
# On the manager, get the join token:
docker swarm join-token worker
# On the worker, run the outputted command:
docker swarm join --token SWMTKN-1-xxxxx 192.168.1.100:2377
Deploy a service using a Compose file:
docker stack deploy -c docker-compose.yml mystack
Swarm reuses Docker Compose syntax (with some extensions under the deploy key). If you already know Docker Compose, you know 90% of Swarm.
Kubernetes
A standard Kubernetes cluster requires multiple cooperating components:
- etcd — distributed key-value store for cluster state
- kube-apiserver — the API frontend for all cluster operations
- kube-scheduler — assigns Pods to nodes
- kube-controller-manager — runs control loops (replication, endpoints, etc.)
- kubelet — agent on each node that runs containers
- kube-proxy — handles network routing on each node
- Container runtime — containerd or CRI-O
Setting this up from scratch with kubeadm is a multi-step, error-prone process. For self-hosting, use a lightweight distribution instead:
k3s (by Rancher/SUSE) is the most popular option for homelabs:
# Install k3s on the first node (server):
curl -sfL https://get.k3s.io | sh -
# Get the node token:
sudo cat /var/lib/rancher/k3s/server/node-token
# Join a worker:
curl -sfL https://get.k3s.io | K3S_URL=https://192.168.1.100:6443 K3S_TOKEN=<token> sh -
k3s bundles all control plane components into a single binary with SQLite (instead of etcd) and includes Traefik as the default Ingress controller. It reduces setup from hours to minutes, but you still need to learn Kubernetes concepts — Pods, Deployments, Services, Ingress, ConfigMaps, PersistentVolumeClaims — before you can deploy anything useful.
microk8s (by Canonical) is another lightweight option:
sudo snap install microk8s --classic
microk8s enable dns storage ingress
Even with these simplified installers, Kubernetes setup and ongoing operation is 10x more complex than Swarm. You are trading simplicity for capability.
Performance and Resource Usage
| Metric | Docker Swarm | Kubernetes (standard) | Kubernetes (k3s) |
|---|---|---|---|
| Control plane idle RAM | ~50 MB | 2-4 GB | 512 MB - 1 GB |
| Per-worker overhead | ~20 MB (Docker daemon already running) | ~300 MB (kubelet + kube-proxy) | ~200 MB |
| Minimum viable cluster | 1 node, 512 MB RAM | 1 node, 4 GB RAM | 1 node, 2 GB RAM |
| Recommended for production | 3 managers + N workers, 2 GB+ RAM per node | 3 control plane + N workers, 4 GB+ RAM per node | 1-3 servers + N agents, 2 GB+ RAM per node |
| Container startup latency | Same as standalone Docker | Slightly higher (scheduling, admission controllers) | Slightly higher |
For a single-node homelab with 4-8 GB RAM, Kubernetes eats a significant portion of your resources before you run a single workload. A standard K8s install can consume 2-4 GB just for the control plane. k3s brings this down to ~512 MB, which is reasonable but still 10x more than Swarm’s ~50 MB overhead.
On a Raspberry Pi 4 (4 GB model) or a budget VPS, that difference is the gap between running 15 services comfortably versus running 10 services at capacity.
Swarm wins on resource efficiency. If your hardware is limited, Swarm lets you dedicate more RAM and CPU to actual workloads.
Community and Support
Kubernetes has one of the largest open-source communities in the world. The CNCF ecosystem includes hundreds of projects — Helm for package management, Prometheus for monitoring, Istio and Linkerd for service meshes, ArgoCD for GitOps, cert-manager for TLS. Every major cloud provider offers managed Kubernetes. Every DevOps job posting mentions it. Documentation is extensive, Stack Overflow has millions of answers, and there are thousands of tutorials for every conceivable use case.
For self-hosting specifically, the K8s community has produced Helm charts for most popular self-hosted apps. Projects like TrueCharts and k8s-at-home provide ready-to-deploy charts for hundreds of applications.
Docker Swarm is in maintenance mode. Docker, Inc. shifted its focus to Docker Desktop, Docker Compose, and Docker Business (their enterprise subscription). Swarm still works — it receives bug fixes and security patches — but it has not gained meaningful new features since roughly 2019. Community activity has declined. Fewer blog posts, fewer tutorials, fewer people answering questions on forums. Most orchestration discussions now assume Kubernetes.
This matters for self-hosting. When you hit a Swarm-specific problem, you may struggle to find recent answers. The Kubernetes community, by contrast, has an answer for almost everything.
Kubernetes wins decisively on community support. Swarm is functional but stagnant.
Use Cases
Choose Docker Swarm If…
- You have 2-5 nodes and want simple high availability for your services
- You already know Docker Compose and don’t want to learn new abstractions
- Your hardware is limited and you can’t spare 2+ GB for a control plane
- You want multi-node orchestration with the least possible operational overhead
- You need this running in an afternoon, not a weekend
- You don’t care about padding your resume with Kubernetes experience
Choose Kubernetes If…
- You run 10+ nodes and need sophisticated scheduling, affinity rules, and resource quotas
- You want to learn Kubernetes for career development — hands-on homelab experience is valuable
- You want the Helm chart ecosystem for easy deployment of complex applications
- You need advanced networking (network policies, service meshes, multi-cluster federation)
- You need fine-grained RBAC for multiple users or teams accessing the cluster
- You’re planning to eventually run workloads on a cloud provider and want local parity
- You want GitOps-style declarative infrastructure management (ArgoCD, Flux)
Choose Neither If…
- You run a single server (this is most self-hosters)
- Your services are all Docker Compose stacks and they work fine
- You don’t need automatic failover across machines
- You have never felt limited by Docker Compose
Seriously — most self-hosters should stay with Docker Compose. Adding an orchestrator to a single-node setup adds complexity with zero benefit. Orchestration solves multi-node problems. If you don’t have multiple nodes, you don’t have those problems. A well-managed Docker Compose setup with good backups and DIUN for image update notifications is all you need.
Final Verdict
Most self-hosters should use neither. Docker Compose on a single server handles the vast majority of homelab workloads. It’s simple, well-documented, and every self-hosted app provides a docker-compose.yml. Adding orchestration on top of a single-node setup is complexity for complexity’s sake.
If you genuinely need multi-node orchestration — you have multiple servers and want services to automatically reschedule when a node goes down — Docker Swarm is the pragmatic choice. It deploys in minutes, reuses your existing Compose knowledge, adds negligible overhead, and handles the core orchestration tasks (scheduling, service discovery, load balancing, rolling updates) competently. For a 2-5 node homelab, Swarm does everything you need.
Kubernetes is the right choice in two scenarios: You’re running a serious multi-node cluster (10+ nodes) where Swarm’s simplicity becomes a limitation, or you want hands-on K8s experience for professional development. The Helm chart ecosystem and the depth of K8s networking, storage, and RBAC capabilities are genuinely powerful. Use k3s to keep the overhead manageable.
The honest reality about Swarm: It’s semi-abandoned. Docker, Inc. is not investing in new features. It works today and will likely continue to work for years, but if Docker decides to deprecate it, there is no migration path except to Kubernetes. If longevity concerns you, learn K8s via k3s now — at least you’re investing in a platform that is actively developed.
FAQ
Can I migrate from Docker Compose to Docker Swarm?
Yes, and it’s straightforward. Docker Swarm uses the same Compose file format with additional keys under the deploy section (replicas, placement, update_config, restart_policy). Take your existing docker-compose.yml, add deploy configurations where needed, and run docker stack deploy -c docker-compose.yml mystack. The main caveat: Swarm stacks don’t support build (you must use pre-built images) and depends_on is ignored — Swarm handles service ordering through health checks and restart policies.
Is Docker Swarm dead?
Not dead, but not actively developed. Swarm mode is still included in Docker Engine, receives security patches, and works reliably. However, it has not received significant new features since 2019. Docker, Inc. has not officially deprecated it, but their focus is clearly elsewhere (Docker Desktop, Docker Compose, Docker Scout). For a homelab that needs simple orchestration today, Swarm is functional and stable. For a long-term bet on container orchestration, Kubernetes is the safer investment.
Can I run k3s on a Raspberry Pi?
Yes. k3s was explicitly designed for resource-constrained environments, including ARM devices. A Raspberry Pi 4 with 4 GB RAM can run a k3s server node with several lightweight workloads. A Pi 4 with 2 GB RAM can serve as a k3s agent (worker) node. The k3s binary is under 100 MB and the control plane runs in a single process. For a Pi-based Kubernetes cluster, k3s is the standard recommendation. Expect the control plane to use 400-600 MB RAM on ARM, leaving less headroom for workloads compared to an x86 machine.
What about HashiCorp Nomad?
Nomad is a third option worth knowing about. It sits between Swarm and Kubernetes in complexity — more capable than Swarm, less complex than K8s. Nomad can orchestrate Docker containers, VMs, raw executables, and Java apps. It uses a single binary, doesn’t require etcd, and has a gentler learning curve than Kubernetes. The downsides: smaller community than K8s, fewer self-hosting tutorials, and the app ecosystem (Helm charts, operators) doesn’t exist for Nomad. If Swarm is too simple and Kubernetes is too much, Nomad is worth evaluating — but the community support gap is real.
Can I use Swarm and Kubernetes together?
Not in a meaningful way. They are competing orchestration layers. Running both on the same nodes would create conflicting network configurations and resource management. Pick one. If you want to experiment with Kubernetes while your production homelab runs Compose or Swarm, set up a separate k3s cluster on different hardware or in VMs.
Related
Get self-hosting tips in your inbox
New guides, comparisons, and setup tutorials — delivered weekly. No spam.
Comments