Bitzu

KCNA ยท Containers and images

Images, layers and registries

Image layers, tags vs digests, registries, pulling and pushing, image immutability.

Key points

  • A container image is a packaged, read-only filesystem plus metadata, built from stacked layers that can be shared and cached between images.
  • Images live in a registry and are referenced as registry/name:tag or registry/name@sha256:digest.
  • A tag is a movable human-friendly label; a digest is a content hash that always points to exactly one image.
  • Running a container never changes its image.

Source: https://kubernetes.io/docs/concepts/containers/images/

Practice questions

Single choice

Which part of an image reference identifies one exact, immutable image?

  1. The digest (sha256:...)
  2. The tag (for example 1.4)
  3. The registry hostname
  4. The repository name
Show answer

Answer: A. The digest (sha256:...)

A digest is a hash of the content, so it cannot point to anything else. Tags can be moved to a different image at any time.

Select all that apply

Which statements about image layers are true?

  1. Layers can be shared between different images
  2. Image layers are read-only
  3. Writing a file in a running container edits the image layers
  4. A tag is a hash of the layer contents
  5. A pull can skip layers already present on the node
Show answer

Answer: A. Layers can be shared between different images, B. Image layers are read-only, E. A pull can skip layers already present on the node

Layers are read-only and reused across images, so a pull skips layers the node already has. Writes in a running container do not alter the image layers, and a tag is a label, not a content hash.

True or false

True or false: an image tag such as 1.0 always refers to the same image content.

Show answer

Answer: False

False. Tags are mutable labels the registry owner can repoint; only a digest is fixed to the content.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More KCNA topics in this module