Images and registries
Follow an image from a registry to a node and learn to tell a release label from the actual bytes.
What you will understand
- Follow the image and container filesystem layers.
- Read an image reference and distinguish tags from digests.
- Tell an image pull failure from an application startup failure.
Builds on: Containers are processes
What a container image contains
Say you want five machines to run the same web server you tried on your laptop. The machines need the program, its libraries, and its starting files. An image packages those files and configuration, including how to start the program. A container is a running instance or a stopped instance made from an image. Two instances can start with identical files and write different temporary files because each has its own writable layer.
Images use layers. If two releases share a base layer, the container runtime can reuse the bytes it already has. A registry is a service that stores and serves image content. When a node needs an image, its container runtime resolves the reference, fetches the manifest, and downloads any missing layers. The runtime then prepares the filesystem and starts the container. Each step can succeed or fail separately.
Which parts of an image can change?
Layers carry image content, an image digest identifies that content, and a running container gets its own writable layer.
Read-only image layers
- web:trainingManifest digestresolves to
- Manifest digestRead-only layersreferences hashes
The image manifest describes immutable layer content and configuration. A repository tag points to a manifest identity.
A separate writable layer
- Read-only layersWeb executablestarting files
- Web executableContainer writable layerruntime writes
The runtime assembles the image filesystem and adds a writable layer for this container instance.
Tags and digests
- Tag now points to BDigest Bnew resolution
- Digest ARunning digest Aoriginal content
A tag may point somewhere new. A recorded digest still identifies the original content; the existing process does not silently switch.
A single-platform image is shown; registries can instead return a multi-platform index.
Explore another case
Read an image reference
Read the example’s nginx:1.27.5 as image name nginx and tag 1.27.5. The omitted registry resolves to a default registry under the usual runtime configuration. A longer reference might spell out the registry and repository. Treat the tag as a name assigned by the publisher. A registry can allow a publisher to move a tag to a different image. A digest, written after @sha256:, identifies specific content by its hash. A multi-platform image can have a digest for the index, which points to separate image manifests for each supported platform.
apiVersion: v1
kind: Pod
metadata:
name: image-demo
spec:
containers:
- name: web
# Training tag: use your verified digest for repeatable releases.
image: nginx:1.27.5
# Reuse this exact reference's local image when available.
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80Save the manifest as image-demo.yaml and use a disposable cluster. When the Pod is assigned to a node, the node’s kubelet asks its runtime for the image. IfNotPresent allows reuse when the requested image is already present locally. This matters with moving tags: one node might have a cached image and a second node might need to fetch it. For a release you need to reproduce, deploy a digest you verified. For exercises like this one, the readable version tag keeps the example short.
kubectl apply -f image-demo.yaml
kubectl get pod image-demo -o wide
kubectl describe pod image-demo
# Show the image identity reported for the running container.
kubectl get pod image-demo -o jsonpath='{.status.containerStatuses[0].imageID}'Check describe when the Pod waits. If the events say the image could not be pulled, look at the reference, registry access, and available platforms. If the image is present and the program repeatedly exits, follow the container’s exit reason and logs instead. The final command prints the image identity reported by the runtime. Use it when you need evidence of which image a Pod actually used.
How does a named image become a running program?
The runtime resolves the name, reuses matching cached content, and starts the configured process.
- Pod specProvide the image referenceKubelet and runtimeThe node learns which image to run.
- RuntimeResolve the referenceImage registryThe manifest names the image’s content.
- Registry and local cacheProvide the required layersRuntimeCached layers remain available and missing layers are fetched.
- RuntimeStart the entrypointContainer processThe image is now the basis of a running process.
The runtime resolves the name, reuses matching cached content, and starts the configured process.
Registry access is from the worker runtime; one node and one image are shown.
Explore another case
Pull an image and then run it
Try explaining this sequence before changing any configuration: the Pod gets a node, the kubelet reports ErrImagePull, then you see ImagePullBackOff. The node was chosen. It is the pull that failed, and the runtime is waiting before another attempt. Compare that with a wrong application command. In that case you can often find a container exit status because the container got far enough to run. The module lab shows the boundary between pulling an image and executing a process.
What changes when a tag moves
Pinning a digest helps you get the same image content again. To decide whether that content should run, also check who built or published it and what your deployment policy trusts. Image pull credentials give access to a registry. Credentials the application itself needs are a separate input.
Check your understanding
Two Pods specify the same moving tag with IfNotPresent. Why could they run different images?
The nodes can have different cache histories. An existing local image can satisfy a request on one node while another node fetches the tag’s current target. Use the same verified digest and compare the reported image identity if byte-for-byte agreement matters.
Primary documentation
Go to the source
Reviewed 2026-10-27 · Kubernetes 1.37 · Related local exercise