TExcelTAD
Home › Software Supply Chain Security: SBOM, SLSA & Sigstore › OCI Images: Manifests, Configs & Layers

OCI Images: Manifests, Configs & Layers

Signing, attesting and pinning container images all rest on one property: an image is a tree of content-addressed blobs, and the hash of the root identifies everything below it. Once you see the tree, digests stop being magic strings. The Images & Layers lesson in the Docker course is the user's view; this is the registry's.

The tree

text
image index (optional, multi-platform)      sha256:…   ← "the image digest" for multi-arch images
 └─ image manifest (one platform)           sha256:…   ← "the image digest" for single-platform images
     ├─ config blob   (JSON: env, entrypoint, history, rootfs.diff_ids)
     ├─ layer blob 1  (tar.gz)
     └─ layer blob 2  (tar.gz)

Every arrow is a descriptor: {mediaType, digest, size}. A digest is sha256: plus the SHA-256 of the exact bytes. The manifest lists the config's and layers' digests, so the manifest's own digest covers all of them: change one byte in any layer and the layer digest changes, so the manifest bytes change, so the image digest changes.

Looking at it with crane

The course image runs a registry on localhost:5000 (CNCF Distribution, started for every session). crane talks to registries directly, without a Docker daemon.

bash · try it yourself
crane push /opt/samples/images/alpine-3.18.0.tar localhost:5000/demo/alpine:3.18.0
crane manifest localhost:5000/demo/alpine:3.18.0 | jq .
2026/10/23 21:55:29 pushed blob: sha256:5e2b554c1c45d22c9d1aa836828828e320a26011b76c08631ac896cbc3625e3e
2026/10/23 21:55:29 pushed blob: sha256:8a49fdb3b6a5ff2bd8ec6a86c05b2922a0f7454579ecc07637e94dfd1d0639b6
2026/10/23 21:55:29 localhost:5000/demo/alpine:3.18.0: digest: sha256:f04ffda0b1406b530a735ae8676c9d6fa527618e842cc66b1bc09ae4dbd44e0b size: 428
localhost:5000/demo/alpine@sha256:f04ffda0b1406b530a735ae8676c9d6fa527618e842cc66b1bc09ae4dbd44e0b
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
  "config": {
    "mediaType": "application/vnd.docker.container.image.v1+json",
    "size": 1472,
    "digest": "sha256:5e2b554c1c45d22c9d1aa836828828e320a26011b76c08631ac896cbc3625e3e"
  },
  "layers": [
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 3397490,
      "digest": "sha256:8a49fdb3b6a5ff2bd8ec6a86c05b2922a0f7454579ecc07637e94dfd1d0639b6"
    }
  ]
}

crane push uploaded two blobs (the config and the single layer), then the manifest, and printed the reference by digest. The manifest uses Docker's media types because it was pushed from a docker save-style tarball; OCI media types (application/vnd.oci.image.manifest.v1+json) are structurally the same.

The digest is a hash of the manifest

bash · try it yourself
crane push /opt/samples/images/alpine-3.18.0.tar localhost:5000/demo/alpine:3.18.0 > /dev/null 2>&1
echo "registry says:  $(crane digest localhost:5000/demo/alpine:3.18.0)"
echo "sha256 of the manifest bytes: sha256:$(crane manifest localhost:5000/demo/alpine:3.18.0 | sha256sum | cut -d' ' -f1)"
L=$(crane manifest localhost:5000/demo/alpine:3.18.0 | jq -r '.layers[0].digest')
echo "layer $L"
echo "sha256 of the layer blob:     sha256:$(crane blob localhost:5000/demo/alpine@$L | sha256sum | cut -d' ' -f1)"
registry says:  sha256:f04ffda0b1406b530a735ae8676c9d6fa527618e842cc66b1bc09ae4dbd44e0b
sha256 of the manifest bytes: sha256:f04ffda0b1406b530a735ae8676c9d6fa527618e842cc66b1bc09ae4dbd44e0b
layer sha256:8a49fdb3b6a5ff2bd8ec6a86c05b2922a0f7454579ecc07637e94dfd1d0639b6
sha256 of the layer blob:     sha256:8a49fdb3b6a5ff2bd8ec6a86c05b2922a0f7454579ecc07637e94dfd1d0639b6

Both pairs are equal, and this is what makes a registry verifiable: the client can check every byte it downloaded against the hash it asked for. A registry or mirror can't hand you different content for a digest without being detected; it can only refuse.

Don't reformat a manifest before hashing it: jq . pretty-prints, which changes the bytes and therefore the hash. Tools always hash the bytes exactly as the registry stored them.

The config

bash · try it yourself
crane push /opt/samples/images/alpine-3.18.0.tar localhost:5000/demo/alpine:3.18.0 > /dev/null 2>&1
crane config localhost:5000/demo/alpine:3.18.0 | jq '{architecture, os, created, cmd: .config.Cmd, history: [.history[].created_by], diff_ids: .rootfs.diff_ids}'
{
  "architecture": "amd64",
  "os": "linux",
  "created": "2023-05-09T23:11:10.132147526Z",
  "cmd": [
    "/bin/sh"
  ],
  "history": [
    "/bin/sh -c #(nop) ADD file:7625ddfd589fb824ee39f1b1eb387b98f3676420ff52f26eb9d975151e889667 in / ",
    "/bin/sh -c #(nop)  CMD [\"/bin/sh\"]"
  ],
  "diff_ids": [
    "sha256:bb01bd7e32b58b6694c8c3622c230171f1cec24001a82068a8d30d338f420d6c"
  ]
}

The config's rootfs.diff_ids are the hashes of the uncompressed layer tars; the manifest lists the compressed blobs. Both are recorded, so the same layer can be recompressed (gzip, zstd) without losing its identity. history is free text written by the builder: useful, but not evidence of anything, since anyone can write anything there. Provenance is the verifiable version of it (SLSA).

Indexes and OCI layouts

Multi-platform images add an index (OCI) or manifest list (Docker) on top: one entry per platform, each pointing to a manifest. docker pull alpine:3.18.0 on an ARM laptop resolves the index and picks the arm64 manifest. That has a consequence for pinning: the digest of the index and the digest of the amd64 manifest are different, and both are "the digest of alpine:3.18.0" depending on who you ask.

The sample image was saved as an OCI image layout, the on-disk format of the same tree (used by crane pull --format oci, skopeo, oras, BuildKit's type=oci exporter):

bash · try it yourself
cd /opt/samples/images/alpine-3.18.0
cat oci-layout; echo
jq -c '.manifests[] | {mediaType, digest: .digest[0:19], size}' index.json
ls blobs/sha256 | cut -c1-12
{
    "imageLayoutVersion": "1.0.0"
}
{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","digest":"sha256:c0669ef34cdc","size":528}
5e2b554c1c45
8a49fdb3b6a5
c0669ef34cdc

index.json points at the manifest by digest; the blobs directory stores each blob under its own hash, exactly like a registry. The manifest digest here (sha256:c0669ef3…) is the platform-specific digest Docker Hub serves for linux/amd64; the course image pinned the pull to it.

Note: The sample's OCI layout and the image pushed to the local registry have different digests (c0669ef3… and f04ffda0…) although they share the config and the layer: the layout keeps Docker Hub's original manifest bytes (528 bytes), while crane push of a tarball writes a freshly generated manifest (428 bytes). Same content, different manifest bytes, different digest. Copying an image through a tool that rewrites manifests can change its digest, which is why you sign after the final push, and copy with tools that preserve manifests (crane copy, oras cp, skopeo copy) afterwards.

Test yourself

Why does changing one file in one layer change the image digest?

  1. Registries recompute all digests nightly
  2. The layer digest changes, the manifest lists it, and the image digest is the hash of the manifest bytes
  3. Tags are part of the digest
  4. The config stores a timestamp

What are rootfs.diff_ids in the image config?

  1. Hashes of the compressed layer blobs
  2. Hashes of the uncompressed layer tars
  3. Tag names
  4. Signatures

A multi-platform image is referred to by two different digests. How can both be correct?

  1. One is a typo
  2. One is the index digest, the other a platform-specific manifest digest
  3. Digests are random
  4. SHA-256 collisions