fivenines
1/40

Theory Tutorial

What Problem Does Docker Solve?

Time
10m
Level
not specified
Artifacts
theory + practice
Progress0%
Lesson 1 · Foundations

What Problem Does Docker Solve?

Design claim: A container engine replaces environment-specific installation with a portable image contract and a controlled way to instantiate it.

Starting model

  • You already understand processes, filesystems, host resources, and client-server APIs; the new question is how a container engine composes them.
  • The useful vocabulary at this point is deliberately small: image, container, registry, daemon.

Deployment is a contract problem

The same application release must cross laptops, CI, staging, and production without being rebuilt for each host. Begin with the guarantee visible to a workload or operator. Kernel machinery matters only after a simpler arrangement can no longer supply that guarantee.

The tempting shortcut is straightforward: document every host dependency and copy the application into place. The shortcut is plausible on a quiet development host, where its missing boundary has not yet been tested. Hosts drift in packages, configuration, permissions, and operating assumptions, so a deployment recipe is not a reproducible artifact. The constraint reveals which responsibility must move before the design can survive isolation or process failure.

Separate the nouns before automating the verbs

Before containers, every app × every environment was a unique deployment problem. Three apps on four environments (laptop, CI, staging, prod) means twelve fragile combinations, each hand-tuned. Docker collapses the matrix with one abstraction: if your app runs in a container, and the environment runs containers, then your app runs in that environment. The container is the contract.

Images carry immutable application content, containers instantiate that content, registries distribute it, and the daemon coordinates the workflow behind an API. The named mechanism is the consequence of that separation: one layer owns policy, another enforces it, and callers receive a stable promise.

Read the topology as a map of authority. Durable knowledge, transient setup, and kernel enforcement should not blur into one box.

Architecture — the four boxes every later lesson refines
  flowchart LR
    subgraph Client["Your terminal"]
      CLI["docker CLI
(thin client)"] end subgraph Host["Docker host"] D["Docker daemon
(the brain)"] IMG[("Image store
frozen snapshots")] CT["Containers
running instances"] end REG[("Registry
shared image shelf")] CLI -- "REST API
(run, build, pull …)" --> D D -- manages --> IMG D -- "creates + supervises" --> CT D -- "pull / push" --> REG IMG -. "instantiate" .-> CT

It separates the thin client, daemon-owned state, runnable containers, and remote registry. Its central claim is that the artifact selected for a release is the artifact instantiated in every environment; the labels therefore describe authority rather than decorative grouping.

A run request crosses four boundaries

Everything in Docker reduces to three nouns. An image is a frozen, immutable snapshot of an app and its dependencies — the recipe and the pantry, sealed together. A container is a running (or runnable) instance of an image — the dish, cooking. A registry is a shared shelf where images are published and fetched. One long-running program, the daemon, manages all three; a thin CLI just sends it requests over an HTTP API.

A run request resolves an image locally, pulls it only when necessary, creates a container record, and starts the configured process. Trace the order carefully; each step establishes a fact the next step is entitled to use.

The second figure tests the same model in motion: it shows local resolution preceding remote transfer and creation preceding start.

Sequence — docker run at 10,000 feet
  sequenceDiagram
    actor U as You
    participant CLI as docker CLI
    participant D as Daemon
    participant R as Registry
    U->>CLI: docker run nginx
    CLI->>D: POST /containers/create (image nginx)
    D->>D: image in local store?
    alt not local
      D->>R: pull nginx
      R-->>D: image data
    end
    D->>D: create container from image
    D->>D: start container
    D-->>CLI: container id + output stream
    CLI-->>U: nginx is running
      

It shows local resolution preceding remote transfer and creation preceding start. The ordering is valid only when it continues to preserve the stated invariant under retries and interruption.

Portability does not mean best-effort substitution

The requested image is absent locally while the registry is unavailable, so the engine must fail without inventing a different release. A sound boundary either preserves its promise or refuses the operation where the promise becomes impossible.

The artifact selected for a release is the artifact instantiated in every environment. This rule survives changes in implementation names because it describes ownership rather than a particular process tree.

The first MiniDock boundary

MiniDock begins by separating user intent, portable content, runnable instances, and remote distribution. MiniDock needs the property now, but its learner must still decide where the responsibility belongs.

What carries forward

  • The artifact selected for a release is the artifact instantiated in every environment.
  • Explain how one packaged application release crosses environments through a container-engine contract.
  • The rejected shortcut remains a diagnostic: if the design starts depending on it again, the original constraint has probably been lost.
Next step

See what actually stuck.

Take the practice scenarios now.

Explore the full Build Your Own Docker track