System Atlas
the atlas

Docker vs Kubernetes

Not a rivalry — one packages a container, the other runs thousands of them.

the gist

Docker builds container images and runs containers on a single host. Kubernetes is an orchestrator that takes those containers and runs them across a whole cluster of machines, handling scheduling, scaling, self-healing, and networking. They are complementary layers of the same stack, not competing alternatives.

ANALOGY // Docker is like knowing how to cook one dish in one kitchen; Kubernetes is the restaurant chain's operations team that staffs every kitchen, reroutes orders when one closes, and opens new branches at the dinner rush.
living diagram01 / 04
Dockerbuild & run · one host
Docker Composemulti-container · one host
Kubernetesorchestrate · whole cluster
Docker packages an app into an image and runs it as a container — reproducible isolation, but scoped to a single host.
01

Docker builds and runs containers

Docker packages your application and its dependencies into an image, then runs that image as an isolated container on a host. It gives you reproducibility — the same image runs identically on a laptop or a server — and process-level isolation without a full virtual machine. This solves 'works on my machine,' but by itself it operates on one host at a time.

02

Compose adds multiple containers

Real apps are several containers — a web server, a database, a cache. Docker Compose lets you declare them all in one file and start them together on a single machine, wired up with a shared network. It's excellent for local development and simple deployments, but it still assumes one host and offers no automatic recovery or scaling across machines.

03

Kubernetes orchestrates a cluster

Kubernetes takes container images and runs them across a cluster of many nodes. You declare the desired state — 'run five replicas of this service' — and its control plane schedules pods onto nodes, restarts them when they crash, scales them up and down, and gives them stable networking and service discovery. It manages containers at fleet scale, which is a fundamentally different job from running one.

04

Complementary, not either/or

The 'versus' framing is misleading: Kubernetes runs the very container images that Docker builds. Docker (or another OCI-compliant runtime) owns the container itself; Kubernetes owns where those containers run, how many, and what happens when things fail. A typical pipeline uses Docker to build the image and Kubernetes to operate it in production.

the full picture
01

Why people frame it as 'versus'

Search for "Docker vs Kubernetes" and you'll find endless comparison tables, which is odd, because the two tools don't actually compete — they sit at different layers of the same stack. The confusion is understandable: both are central to running containers, both come up in the same conversations, and newcomers reasonably assume they must be alternatives. They are not. Docker is about *making and running a container*; Kubernetes is about *running many containers across many machines*. Getting this distinction right is the whole point of the question.

The cleanest way to hold it in your head: Docker answers "how do I package and start this one app?" and Kubernetes answers "how do I keep hundreds of these running reliably across a fleet of servers?" One is a building block, the other is the system that manages thousands of those blocks.

02

What Docker actually does

Docker popularized the modern container. Its two core jobs are building images and running containers:

  • A Dockerfile describes how to assemble an image — your application code plus every dependency, library, and setting it needs, frozen into a portable artifact.
  • The Docker engine then runs that image as a container: an isolated process with its own filesystem and network view, sharing the host's kernel rather than booting a whole operating system like a virtual machine.

The payoff is reproducibility and isolation. The same image runs identically on a developer's laptop, a CI server, and production, which finally kills the "works on my machine" problem. But notice the scope: Docker fundamentally operates on one host. It will happily run many containers on that host, and Docker Compose lets you declare a multi-container app (web + database + cache) in a single file and bring it all up together — but it is still a single machine, with no notion of spreading work across a cluster or recovering from a machine dying.

03

What Kubernetes actually does

Kubernetes (often "K8s") starts where a single host runs out. It is a container orchestrator: you give it a cluster of machines (nodes) and a declaration of the desired state, and it makes reality match that declaration and keeps it there. You don't tell it "start this container on that server" — you say "I want five replicas of this service running," and Kubernetes figures out the rest.

The orchestration responsibilities it takes on include:

  • Scheduling — deciding which node each container (wrapped in a *pod*) should run on, based on resource requests and constraints.
  • Scaling — adding or removing replicas as load changes, and even adding or removing whole nodes.
  • Self-healing — restarting crashed containers, replacing pods on failed nodes, and only routing traffic to instances that pass health checks.
  • Service discovery and networking — giving pods stable virtual IPs and DNS names, and load-balancing across replicas so callers never need to know where a pod physically lives.

This is a genuinely different job from running a container. Docker gives you a container; Kubernetes gives you a resilient, self-managing distributed system built out of many of them.

04

How they fit together

Because they live at different layers, the real architecture is a stack, not a choice. In a typical workflow, Docker builds an image and pushes it to a registry; a CI pipeline hands that image to Kubernetes; and Kubernetes pulls the image and runs it as pods across the cluster, scaling and healing as needed.

There's a historical wrinkle worth knowing: Kubernetes needs a *container runtime* on each node to actually start containers, and it talks to that runtime through a standard interface (the CRI). Docker's runtime pieces were long the default, but Kubernetes now uses lighter OCI-compliant runtimes like containerd or CRI-O directly. This is why you may have heard that "Kubernetes deprecated Docker" — it dropped a specific compatibility shim (dockershim), not the ability to run Docker-built images. The images you build with Docker follow the open OCI standard and run on Kubernetes exactly as before.

05

Choosing what you actually need

Practically, the question is rarely "Docker or Kubernetes" and almost always "do I need Kubernetes *yet*?" For local development, a demo, or a small service on a single server, Docker and Docker Compose are the whole answer — simple, fast, and enough. Reaching for Kubernetes there adds a control plane, networking layers, and a steep learning curve to solve problems you don't have.

Kubernetes earns its complexity when you genuinely operate at scale: many services, high availability requirements, traffic that must be load-balanced across replicas, deployments that must roll out without downtime, and infrastructure that should heal itself at 3 a.m. without paging anyone. At that point its scheduling, scaling, and self-healing pay for themselves many times over. The mature view is that these tools are teammates: you will almost always use Docker to build and run your containers, and you add Kubernetes on top when running a handful of containers turns into running a fleet.

what to remember
01

Docker's job is to build an image and run a container — mostly on one machine.

02

Kubernetes' job is to orchestrate many containers across many machines (a cluster).

03

Orchestration means scheduling pods onto nodes, scaling, self-healing, service discovery, and networking.

04

Docker Compose handles multi-container apps on a single host; Kubernetes handles them across a fleet.

05

They stack: Docker (or another runtime) builds and runs the container, Kubernetes decides where and how many.

06

You almost never choose one 'instead of' the other — Kubernetes runs container images that Docker helped create.

check yourself

Quick quiz

Q1

What does Kubernetes add on top of running a container?

Q2

Which statement best describes their relationship?

follow the thread