Full Byte Developer.

Docker vs Swarm vs Kubernetes, plain comparison

Engine runs containers, Compose defines apps, Swarm and Kubernetes keep cluster desired state. No market-share claims.

Published here , updated · 11 sources

Docker Engine packages and runs containers. Docker Compose defines multi-container apps, usually on one node [4]. Swarm mode and Kubernetes are cluster orchestrators that keep a declared desired state across nodes [1][9]. Climb the ladder with docs, not market-share percentages. Builds on what is a container, why Docker was introduced, and how Docker works.

Quick start: init Swarm and list the node

Commands follow Docker's Swarm overview and stack-deploy tutorial family. Run them on a machine where you may reset local Swarm state [1][3].

bash
docker swarm init
docker node ls

Captured on this host (Docker Engine 29.1.3). Node IDs change per init. Sandbox capture on the review host; re-run on your box before you treat the numbers as a lab result.

text
Swarm initialized: current node (unl0wbq8vsyrps91auiietc9w) is now a manager.
ID                            HOSTNAME   STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
unl0wbq8vsyrps91auiietc9w *   cursor     Ready     Active         Leader           29.1.3

You should see Swarm initialized and one Ready manager. That proves Swarm mode is present in current Engine; it does not deploy your app yet [1].

Split the three jobs before you compare brands

JobToolWhat docs claim
Package / runDocker EngineContainers as runnable image instances
Define multi-container appComposeOne YAML project; start/stop/rebuild lifecycle [4]
Orchestrate a clusterSwarm mode or KubernetesDesired-state scheduling across nodes [1][9]

Swarm mode overview: current Docker versions include Swarm mode for managing a cluster of Docker Engines. Do not confuse it with Classic Swarm, which is no longer actively developed [1]. Classic Swarm (and overlay networks using an external cluster store) were deprecated in Engine v20.10 and removed in v23.0 [6].

package, define, then orchestrate Docker Engine run containers Compose define the app [4] Swarm mode or Kubernetes desired state [1][9] stack deploy uses legacy Compose v3; Compose Bridge aims at Kubernetes manifests [3][5] Classic Swarm is gone; Swarm mode remains in Engine [1][6]

Left to right: Docker Engine runs containers, Compose defines the multi-container app, then Swarm mode or Kubernetes keeps desired state across nodes. Footnotes call out stack deploy on legacy Compose v3 and Classic Swarm removal while Swarm mode stays in Engine.

Read Swarm mode as still present, with slowed SwarmKit investment

Docker's Swarm overview still documents integrated cluster management, declarative services, scaling, desired-state reconciliation, overlay networking, service discovery, load balancing, mutual TLS between nodes, and rolling updates [1][2]. Engine 29.x notes still ship Swarm-related networking fixes [8].

Docker's retired / open-source notes: SwarmKit powers Swarm mode; "While Swarm mode remains functional, development has slowed in favor of Kubernetes-based solutions" [7]. That is a roadmap honesty note, not a claim that Swarm mode was removed.

Deploy a tiny stack, then tear it down

Per the stack-deploy tutorial, even when Engine is in swarm mode, docker compose up still schedules all containers on the current node; use docker stack deploy for multi-node placement [3]. Docs also note that docker stack deploy accepts legacy Compose file version 3 only; the latest Compose Specification format is not compatible with that command [3].

Example compose file used for the capture below:

compose.yaml
services:
  web:
    image: nginx:alpine
    ports:
      - "8080:80"
bash
docker stack deploy --compose-file compose.yaml stackdemo
docker stack services stackdemo

Captured shape on this host after docker pull nginx:alpine (replica count can sit at 0/1 until the task settles):

text
Creating network stackdemo_default
Creating service stackdemo_web
ID             NAME            MODE         REPLICAS   IMAGE          PORTS
hyqw4hary6pm   stackdemo_web   replicated   0/1        nginx:alpine   *:8080->80/tcp

You should see a stackdemo_web service listed when the compose file and image are valid [3]. Teardown from the same tutorial family:

bash
docker stack rm stackdemo
docker swarm leave --force

Captured leave line:

text
Node left the swarm.

Compare Kubernetes on documented axes only

Kubernetes is a portable, extensible open-source platform for managing containerized workloads with declarative configuration and automation, with a large ecosystem [9]. It provides service discovery and load balancing, storage orchestration, rollouts/rollbacks, bin packing, self-healing, secrets and config, batch execution, horizontal scaling, dual-stack networking, and explicit extensibility [9]. Control plane pieces include kube-apiserver, etcd, kube-scheduler, and controllers; nodes run kubelet and a container runtime [10].

Kubernetes docs also say what it is not: not a traditional all-inclusive PaaS, not a source-to-image builder, not a bundled database product, and not a mandate for one logging stack [9].

Fair axes without invented adoption numbers:

  • Control-plane surface: Swarm managers built into Engine [2] vs Kubernetes apiserver/etcd/scheduler/controllers [10].
  • Schedule scope: Compose on one node vs Swarm tasks / Kubernetes Pods across workers [3][9].
  • Extensibility: Swarm integrated Engine features vs Kubernetes addons and CRDs [1][9].
  • Path from Compose: docker stack deploy (legacy v3) [3] vs Compose Bridge to Kubernetes manifests and Kustomize [5].

Company blogs (for example GitHub Engineering's 2017 Kubernetes migration) show Kubernetes at scale narratives; they are not Swarm status updates [11]. Primary Docker and Kubernetes docs still win for definitions.

Use Compose Bridge when the destination is Kubernetes

Compose Bridge converts Compose configuration into platform-specific formats; the default path produces Kubernetes manifests and a Kustomize overlay aimed at Desktop Kubernetes [5]. Follow the "Use Compose Bridge" guide for flags rather than inventing them here [5]. Desktop Kubernetes is a development path, not proof that your production cluster is ready.

Mistakes that mix the ladder rungs

Saying "Docker Swarm is deprecated" when you mean Classic Swarm: Swarm mode remains documented in Engine; Classic Swarm was removed [1][6][7].

Expecting docker compose up to place tasks across a multi-node swarm: docs warn it stays on the current node; use docker stack deploy [3].

Feeding the newest Compose Specification into docker stack deploy: docs limit that command to legacy Compose file version 3 [3].

Calling Kubernetes a full PaaS that ships your database and logging stack by default: the overview page denies that framing [9].

Inventing market-share percentages to settle Swarm versus Kubernetes: use the documented axes above instead [1][9].

Depth: desired state is the shared idea

Swarm services and Kubernetes controllers both chase a declared desired state [1][9]. The difference that matters in a hiring or platform review is control-plane surface and extensibility, not a slogan. If your team already lives in Engine and needs a small cluster with stack deploy, Swarm mode is still a documented path [1][3]. If you need CRDs, a large addon ecosystem, and the Kubernetes API, start from the Kubernetes overview and components pages [9][10].

When you only need image versus container vocabulary, stay on what is a container and how Docker works. This page starts after that packaging story.

Interview answer that stays honest

"Is Swarm dead?" is a common whiteboard trap. The honest short answer: Classic Swarm is gone; Swarm mode remains built into Docker Engine; SwarmKit investment has slowed while the mode stays functional [1][6][7]. "Should we use Kubernetes?" is a different question. Answer it with workload size, need for CRDs and addons, and who will run the control plane, not with a viral market-share slide [9][10].

A second trap: treating Compose as an orchestrator. Compose defines and runs a project, usually on one node [4]. Orchestration across nodes is Swarm mode or Kubernetes [1][9]. Keep those three nouns separate in the design doc and the resume bullet.

A modest engine cube in front of two cluster diagrams: on the left a simple teal ring of identical container cubes around a coordinator sphere, and on the right a taller amber control-plane of layered hex planes guiding many small pod cubes, with no logos or typography.
The engine runs one box. A cluster manager keeps a desired state across many.

Keep this guide

By Full Byte Developer

Filed under Dev explainers

Questions about this guide

Is Docker Swarm deprecated?

Do not say that about Swarm mode. Docker Docs still document Swarm mode as built into current Docker Engine. Classic Swarm was deprecated and removed. Docker's retired-products page says SwarmKit development has slowed while Swarm mode remains functional.

Does docker compose up spread across a swarm?

No. Docker's stack-deploy tutorial warns that Compose schedules all containers on the current node even when Engine is in swarm mode. Use docker stack deploy for multi-node Swarm stacks.

Can docker stack deploy use the latest Compose Specification?

No. Docs say stack deploy uses legacy Compose file version 3. The latest Compose Specification format is not compatible with that command.

Is Kubernetes a full PaaS?

Kubernetes docs say it is not a traditional all-inclusive PaaS. It does not deploy your source, ship databases as built-ins, or mandate logging and monitoring.

Sources

Next in this stack