Ground floorLesson 1 of 3
  1. Containers in Kubernetes terms, not reconciled
    1. Images are layers plus a manifest
    2. Tags, digests and pull policy
    3. ENTRYPOINT and CMD become command and args
    4. Building images for a cluster
    5. From kubelet to process
    6. Registries and credentials
  2. Isolation: namespaces, cgroups and the runtime, not reconciled
  3. DNS in Kubernetes terms, not reconciled

Containers in Kubernetes terms

An image is content-addressed layers plus a manifest, and a container is a process the kubelet asks a CRI runtime to start. This is the part of the container toolchain a pod spec controls.

  • 16 min
  • 4 objectives
  • 6 scenes

Shows the lesson one block at a time. Arrow keys step, number keys jump to a scene, and Escape returns to the page where you were.

Kubernetes never builds an image and never runs a container itself. It stores a pod spec that names an image, and the kubeletThe agent on every node that turns pod specs into running containers and reports their status. on the chosen node asks a container runtime to pull that image and start a process from it. This lesson covers both halves of that handoff: what an image is, and what the runtime does with it.

Reconcile, in 6 scenes

Images are layers plus a manifest

An OCI imageA container image in the Open Container Initiative format: filesystem layers, a config blob and a manifest that lists them by digest. is not one file. It is a set of blobs in a registry, each named by the SHA-256 of its content:

  • Layers are tar archives of filesystem changes. The runtime stacks them in order to build the container’s root filesystem.
  • The config is a JSON document holding the default ENTRYPOINT, CMD, environment, working directory and user, the target platform, and the ordered digests of the uncompressed layers (diff IDs).
  • The manifest lists the config and the layers by digest, size and media type.
  • An image index points at one manifest per platform, so linux/amd64 and linux/arm64 nodes pull different layers under the same name.

Because every reference is a content hash, a node never downloads a layer it already holds, and images built on the same base share those layers on disk. On a node, containerd unpacks layers through a snapshotter, overlayfs by default. Docker Engine’s storage drivers matter only on a Docker host: aufs was removed in Docker Engine 24 and devicemapper in Docker Engine 25, and fresh installs of Docker Engine 29 use the containerd image store.

Tags, digests and pull policy

A reference has up to four parts: registry/repository:tag@digest. Leave out the registry and Docker Hub is assumed; leave out the tag and latest is assumed, so nginx means docker.io/library/nginx:latest. The latest tag is a name like any other. It does not mean newest.

A tag is a mutable pointer: anyone who can push to the repository can move myapp:v2 to different content tomorrow. A digestThe SHA-256 of an image manifest or index, written sha256:…. It names exactly one image and cannot be repointed. cannot move. The manifest lists the config and layer digests, so pinning the manifest pins every byte. When a reference carries both a tag and a digest, only the digest is used for the pull.

imagePullPolicy decides when the kubelet contacts the registry:

PolicyBehaviour
IfNotPresentPull only when the node has no copy of the image.
AlwaysResolve the reference against the registry each time a container starts; layers download only when the digest has changed.
NeverUse the node’s copy or fail.

Leave the field out and the API server fills it in when the object is created: Always for a :latest tag or no tag, IfNotPresent for any other tag or for a digest. Here nginx:1.30 names nginx’s stable branch, while latest follows the mainline branch, 1.31. The container status records which digest the tag resolved to:

Defaulted pull policies, and the digest a tag resolved to
kubectl get pods pinned floating -o custom-columns=NAME:.metadata.name,IMAGE:.spec.containers[0].image,POLICY:.spec.containers[0].imagePullPolicy
NAME       IMAGE        POLICY
pinned     nginx:1.30   IfNotPresent
floating   nginx        Always
kubectl get pod pinned -o jsonpath='{.status.containerStatuses[0].imageID}'
docker.io/library/nginx@sha256:5d1c5d5e53f3850eff3c6c4beb506a3dca2a50721d26f05e6971ccc709fb7afd

ENTRYPOINT and CMD become command and args

The image config carries a default executable (ENTRYPOINT) and default arguments (CMD). In a container spec, command replaces ENTRYPOINT and args replaces CMD:

The container spec setsThe process that runs
neitherimage ENTRYPOINT followed by image CMD
args onlyimage ENTRYPOINT followed by your args
command onlyyour command; the image CMD is dropped
bothyour command followed by your args

The third row is the trap. Setting command alone discards the image’s default arguments, and putting a flag in command makes the runtime try to execute the flag. The simulator’s ghcr.io/kx-labs/web image has ENTRYPOINT ["/usr/local/bin/web"]; this pod meant to change its port:

apiVersion: v1
kind: Pod
metadata:
  name: wrong-command
spec:
  containers:
  - name: web
    image: ghcr.io/kx-labs/web:1.1
    command: ["--port=9090"]
A flag in command replaces the executable
kubectl get pod wrong-command
NAME            READY   STATUS             RESTARTS      AGE
wrong-command   0/1     CrashLoopBackOff   2 (15s ago)   30s
kubectl get pod wrong-command -o jsonpath='{.status.containerStatuses[0].lastState.terminated.message}'
failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: exec: "--port=9090": executable file not found in $PATH: unknown

The message names every layer of the stack: containerd, its shim, then runc failing to exec the string --port=9090. The fix is args: ["--port=9090"].

Two Dockerfile rules decide what the defaults are. An image that does not set ENTRYPOINT inherits its base image’s, and setting ENTRYPOINT clears any CMD inherited from the base. Write both in exec form (["/web", "--port=8080"]) so the binary is PID 1 and receives SIGTERM; shell form wraps it in /bin/sh -c, which does not forward the signal, so the pod sits out its whole grace period before SIGKILL.

Building images for a cluster

BuildKit is the default builder for Docker Desktop and Docker Engine. Some of what a Dockerfile says, Kubernetes reads from the image config, and some it ignores:

Dockerfile instructionWhat Kubernetes does with it
RUN, COPY, ADDCreate filesystem layers. WORKDIR adds one only when it creates a directory; ENV, CMD, EXPOSE and the rest change only the config.
ENV KEY=valueBecomes default environment; env in the pod spec wins on conflict. The space-separated ENV KEY value form is deprecated.
USER 10001Becomes the default user. runAsNonRoot: true can verify only a numeric user.
EXPOSE 8080Not used. It documents the port for docker run -P and publishes nothing; containerPort in a pod spec is informational too.
HEALTHCHECKNot used. Docker and Swarm run it; the kubelet runs only the liveness, readiness and startup probes in the pod spec.

A multi-stage build compiles in one stage and copies only the result into a minimal final stage, which cuts pull time and leaves no shell or package manager for an attacker. ARG is the only instruction allowed before FROM.

# syntax=docker/dockerfile:1
FROM golang:1.27 AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /out/web ./cmd/web

FROM gcr.io/distroless/static-debian13:nonroot
COPY --from=build /out/web /web
USER 65532:65532
ENTRYPOINT ["/web"]
CMD ["--port=8080"]

A numeric non-root USER matters more than it looks: without user namespaces, root in a container is UID 0 on the host, held back only by capabilities, seccomp and Linux security modules. Pods opt in to user namespaces with hostUsers: false, GA in Kubernetes 1.36 and off unless a pod sets it.

From kubelet to process

The kubelet does not talk to Docker. It speaks the CRIContainer Runtime Interface: the gRPC API the kubelet uses to ask a runtime to pull images and create pod sandboxes and containers. to a runtime, usually containerd or CRI-O. Kubernetes 1.36 and later need containerd 2.0 or later. For each pod the runtime creates a sandbox that holds the pod’s shared network namespace, then for each container it unpacks the image and hands an OCI runtime spec to runc (or crun), which creates the process in its namespaces and cgroups. From Kubernetes 1.35 the kubelet refuses to start on a cgroup v1 node unless failCgroupV1: false is set.

Registries and credentials

The node pulls the image, not your laptop, so docker login on your machine means nothing to the cluster. A node authenticates with an imagePullSecrets entry on the pod (a kubernetes.io/dockerconfigjson Secret) or with a kubelet credential provider plugin that fetches short-lived registry tokens. Both a missing credential and a tag that was never pushed look the same at first glance:

A tag that does not exist
kubectl get pod typo
NAME   READY   STATUS             RESTARTS   AGE
typo   0/1     ImagePullBackOff   0          30s
kubectl get events --field-selector involvedObject.name=typo
LAST SEEN   TYPE      REASON      OBJECT     MESSAGE
30s         Normal    Scheduled   pod/typo   Successfully assigned default/typo to kx-worker3
18s         Normal    Pulling     pod/typo   Pulling image "nginx:1.300"
17s         Warning   Failed      pod/typo   Failed to pull image "nginx:1.300": rpc error: code = NotFound desc = failed to pull and unpack image "docker.io/library/nginx:1.300": failed to resolve reference "docker.io/library/nginx:1.300": docker.io/library/nginx:1.300: not found
17s         Warning   Failed      pod/typo   Error: ErrImagePull
16s         Normal    BackOff     pod/typo   Back-off pulling image "nginx:1.300"
16s         Warning   Failed      pod/typo   Error: ImagePullBackOff

ErrImagePull is one failed attempt; ImagePullBackOff means the kubelet is waiting before the next one, raising the delay each time up to a five-minute cap. The Failed event carries the reason: not found for a wrong tag, an authorization error such as 401 Unauthorized or pull access denied for credentials, and toomanyrequests when a registry rate-limits the node. In November 2026 Docker Hub allowed unauthenticated clients 100 pulls per 6 hours per IPv4 address or IPv6 /64, and personal accounts 200, so a busy cluster pulling anonymously through one NAT address hits that limit. The bad-tag-rollout incident is this failure in the middle of a Deployment rollout.

Watch the defaults on your cluster

  1. kubectl --context kind-kx run untagged --image=nginx
  2. kubectl --context kind-kx run stable --image=nginx:1.30
  3. kubectl --context kind-kx get pods untagged stable -o custom-columns=NAME:.metadata.name,POLICY:.spec.containers[0].imagePullPolicy,DIGEST:.status.containerStatuses[0].imageID
  4. kubectl --context kind-kx run missing-tag --image=nginx:1.300
  5. kubectl --context kind-kx get events --field-selector involvedObject.name=missing-tag
  6. kubectl --context kind-kx delete pod untagged stable missing-tag

For your own kind cluster kx: copy a command and paste it into your terminal. Run in the simulator runs the same command in this page's simulated cluster instead; nothing on this page touches your machine. The untagged pod gets Always and the stable pod IfNotPresent; missing-tag reaches ImagePullBackOff with a not found event.

Actual state

Check your understanding

5 checks

Your first answer to each check is the one that counts. After a miss you can answer again; passing every check reconciles the lesson.

  1. Check 1 of 5

    A pod names image: nginx and leaves imagePullPolicy out. What policy does the API server store?

  2. Check 2 of 5

    An image has ENTRYPOINT ["/usr/local/bin/web"] and CMD ["--port=8080"]. The container spec sets only args ["--port=9090"]. What runs?

  3. Check 3 of 5

    What is an image digest such as sha256:5d1c… a hash of?

  4. Check 4 of 5

    Which component creates the container process itself, setting up its namespaces and cgroups?

  5. Check 5 of 5

    Check runs your command on a private cluster; what it prints shows here.

Lesson not yet reconciled

Desired: 4 objectives, 0 metReconciled: 4 of 4 objectives met

  • Explain what an OCI image is, in terms of content-addressed layers, a config and a manifest. (not yet met)
  • Map Dockerfile ENTRYPOINT and CMD onto a container's command and args. (not yet met)
  • Say why a tag is a mutable pointer and a digest is not, and choose one for a manifest. (not yet met)
  • Name the pieces between the kubelet and a running process, namely CRI, containerd and runc. (not yet met)

Pass every check above to reconcile this lesson.

Every check has passed, so the desired state is met. First-try accuracy: 0 of 5. This lesson's review cards are in your queue.

Practice

Put this lesson to work on the simulated cluster. Everything runs in your browser, with nothing to install.

Changed since the notes

This lesson draws on an earlier set of study notes. Where the documentation contradicts a claim in them, qualifies it or has moved past it, the claim is listed here with the corrected statement and the source it was checked against.

Show 16 corrections
  1. Nuance, true with conditionsContainer Fundamentals

    The notes saidDropping Docker support just removed the shim so Kubernetes talks directly to containerd (two entries)

    Correcteddockershim was deprecated in v1.20 and removed in v1.24. The kubelet talks CRI to any CRI runtime, such as containerd or CRI-O. Docker Engine works only through the external cri-dockerd adapter maintained by Mirantis.

    Sourcekubernetes.io/blog/2022/02/17/dockershim-faq

  2. Nuance, true with conditionsContainer Fundamentals

    The notes saidIn modern Linux systems, cgroups v2 provides a unified hierarchy

    CorrectedTrue. Kubernetes context: from v1.35 the kubelet refuses to start on cgroup v1 unless failCgroupV1: false is set. On EKS, AL2023 uses cgroup v2; Bottlerocket 1.35 uses v2 but sets failCgroupV1: false; Fargate still uses v1. Removal of the v1 fallback (KEP-5573) is placed at v1.38 only by secondary sources and is unconfirmed.

    Sourcekubernetes.io/blog/2026/10/06/kubernetes-cgroups-v2-shift

  3. Nuance, true with conditionsContainer Fundamentals

    The notes saidUser namespace: a process can be root inside its namespace but unprivileged on the host

    CorrectedTrue for the kernel feature. Kubernetes pod user namespaces (hostUsers: false) are GA in v1.36 and remain opt-in per Pod.

    Sourcekubernetes.io/blog/2026/04/23/kubernetes-v1-36-userns-ga

  4. Nuance, true with conditionsContainer Fundamentals

    The notes saidImplies user namespaces are part of normal container isolation

    CorrectedThey are off by default. Docker userns-remap is a daemon-level opt-in, and Kubernetes needs hostUsers: false on each Pod (GA in v1.36). Without them, root in a container is host UID 0, limited by capabilities, seccomp and LSMs.

    Sourcedocs.docker.com/engine/security/userns-remap

  5. Stale, true once, no longerDocker Architecture

    The notes saidoverlay2 is the default; aufs, btrfs and devicemapper are available

    Correctedaufs was removed in Docker Engine v24.0 and devicemapper in v25.0. Fresh installs of Docker Engine 29.0+ default to the containerd image store (snapshotters). Upgraded hosts keep overlay2 until switched.

    Sourcedocs.docker.com/engine/storage/containerd

  6. Nuance, true with conditionsDocker Architecture

    The notes saidDocker Hub provides free public repositories and paid private repositories

    CorrectedPlans change. Pull limits: unauthenticated users get 100 pulls per 6 hours per IPv4 address or IPv6 /64, Personal accounts 200 per 6 hours, and Pro/Team/Business are unlimited under fair use. Hitting a limit gives toomanyrequests and ImagePullBackOff. Per-plan private-repo allowances were not re-verified.

    Sourcedocs.docker.com/docker-hub/usage/pulls

  7. Stale, true once, no longerDocker Architecture

    The notes saidnginx:1.21 / nginx:1.21.6 examples

    Corrected1.21 is a 2021 mainline branch. The current stable branch is 1.30 (first released 2026-04-14) and mainline is 1.31.

    Sourcenginx.org/2026.html

  8. Nuance, true with conditionsDocker Architecture

    The notes saidDigest is a hash of the image configuration and layers

    CorrectedThe digest is the SHA-256 of the image manifest, or of the image index for multi-platform images. The manifest lists the config and layer digests, so the digest covers them indirectly.

    Sourcegithub.com/opencontainers/image-spec/blob/v1.0/manifest.md

  9. Stale, true once, no longerDockerfiles Deep Dive

    The notes saidFROM ubuntu:22.04, python:3.11-slim, golang:1.21

    CorrectedCurrent versions are Ubuntu 26.04 LTS (2026-04-23), Python 3.15 (2026-10-09) and Go 1.27 (2026-08-19). Go 1.25 is no longer supported.

    Sourcego.dev/doc/go1.27

  10. Nuance, true with conditionsDockerfiles Deep Dive

    The notes saidBuildKit, Docker's modern build backend

    CorrectedBuildKit is the default builder for Docker Desktop and Docker Engine users. The current page does not name the Engine version where it became the default.

    Sourcedocs.docker.com/build/buildkit

  11. Nuance, true with conditionsDockerfiles Deep Dive

    The notes saidThe older syntax ENV MY_VAR value is still supported

    CorrectedIt is supported for backward compatibility but deprecated. The LegacyKeyValueFormat build check warns about it, and the Dockerfile reference says it may be removed in a future release. Use ENV KEY=value.

    Sourcedocs.docker.com/reference/build-checks/legacy-key-value-format

  12. Wrong, not trueDockerfiles Deep Dive

    The notes saidEach instruction in the Dockerfile creates a layer

    CorrectedOnly instructions that change files create layers: RUN, COPY, ADD, and WORKDIR when it creates a directory. EXPOSE, CMD, ENV and similar only set image metadata.

    Sourcedocs.docker.com/get-started/docker-concepts/building-images/understanding-image-layers

  13. Nuance, true with conditionsDockerfiles Deep Dive

    The notes saidEvery Dockerfile must start with a FROM instruction

    CorrectedFROM can come after parser directives, comments and global ARGs. ARG is the only instruction allowed before FROM.

    Sourcedocs.docker.com/reference/dockerfile

  14. Nuance, true with conditionsDockerfiles Deep Dive

    The notes saidIf you don't specify ENTRYPOINT, it defaults to an empty value

    CorrectedIf you don't set ENTRYPOINT, the image inherits the base image's ENTRYPOINT. Setting ENTRYPOINT clears an inherited CMD.

    Sourcedocs.docker.com/reference/dockerfile

  15. Nuance, true with conditionsDockerfiles Deep Dive

    The notes saidHEALTHCHECK is used by orchestrators

    CorrectedDocker and Swarm use HEALTHCHECK. Kubernetes uses the liveness, readiness and startup probes in the Pod spec (exec, grpc, httpGet, tcpSocket). I found no primary Kubernetes page that says outright that HEALTHCHECK is ignored.

    Sourcekubernetes.io/docs/concepts/workloads/pods/probes

  16. Nuance, true with conditionsDockerfiles Deep Dive

    The notes saidEXPOSE is used by some orchestration systems for networking

    CorrectedEXPOSE does not publish a port. It documents the port and is used by docker run -P. Kubernetes does not use it, and containerPort is informational too.

    Sourcedocs.docker.com/reference/dockerfile

Every correction across the guide, by note and topic.

Sources

Checked against kubernetes.io, OCI image-spec and Docker documentation for Kubernetes 1.37 on .

  1. kubernetes.io/docs/concepts/containers/images
  2. kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container
  3. kubernetes.io/docs/concepts/containers/cri
  4. kubernetes.io/docs/setup/production-environment/container-runtimes
  5. kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim
  6. kubernetes.io/docs/tasks/administer-cluster/kubelet-credential-provider
  7. github.com/opencontainers/image-spec/blob/main/manifest.md
  8. github.com/opencontainers/image-spec/blob/main/image-index.md
  9. docs.docker.com/reference/dockerfile
  10. docs.docker.com/build/building/multi-stage
  11. docs.docker.com/build/buildkit
  12. docs.docker.com/engine/storage/containerd
  13. docs.docker.com/docker-hub/usage

Containers in Kubernetes terms

↓ ↑ step, 1 to 6 scene, Esc leave

kind cluster kxLast command: Nothing run yet