Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Read an OCI image and verify its digest

By updated

Improve this page

A container image opens without an engine: it is a handful of JSON files and an archive, each named by its sha256 fingerprint. This lesson is for readers who have read the theory about layers and OCI and now want to see an image with their own eyes.

You query the registry for the tag alpine:3.24.2 with skopeo and read the multi-architecture index it returns. You copy the image into a local folder, follow its files with jq and recompute every digest. Then you modify a byte to see the image refused, and an exercise repeats the walk-through on another image.

What you will learn

  • Resolve a tag and tell whether it points to an index or to a manifest.
  • Recompute a digest with sha256sum and compare it with the registry's.
  • Copy an image by digest into a local OCI layout and describe its files.
  • Follow the chain index, manifest, config, layer with jq and tar.
  • Tell a layer's digest from its diff_id.
  • Verify all the blobs of a layout, then produce a replayable receipt of them with sha256sum -c.
  • Trigger and read the refusal of a tampered image.
  • Compare a manifest's digest in the registry and in the copied layout, and explain where a possible difference comes from.

Prerequisites

No container engine is needed, not even Docker: this lesson of the Docker training starts no container. Two readings prepare it. Container images: layers and content explains layers. Understand OCI: image, distribution and runtime defines tag, digest, manifest, index, configuration and layers: those terms are not redefined here.

On your side, you need a Linux machine (a Debian 13 VM in the examples), network access to Docker Hub and three tools:

  • skopeo reads and copies images between registries and folders without a daemon, so without a running engine (the full guide is Skopeo);
  • jq reads and filters JSON: the filters in the lesson can be copied as they are, what matters is reading what they extract;
  • umoci turns a layout (an image folder, introduced below) into a runnable folder; it is only used in the last experiment, the refusal of a tampered image.
Terminal window
apt install skopeo jq umoci
skopeo --version
jq --version
umoci --version

The output must show skopeo version 1.18.0, jq-1.7, then umoci version 0.4.7. Your versions may be newer: the error messages quoted in the lesson are those of skopeo 1.18 and umoci 0.4.7. The commands are run as root, hence the paths under /srv/oci. If you are not root, pick a folder you own.

Which chain do you follow to read an image?

An OCI image is read as a chain of files that designate each other by fingerprint: the index designates manifests, a manifest designates a configuration and layers. Each arrow carries the sha256 of its target, so following the chain means opening a file, reading a digest in it, then opening the file with that name.

Read the diagram from top to bottom. At the top, the index of the tag 3.24.2 (heavier outline) is a list of manifests: it holds sixteen of them, platform manifests (including linux/amd64 and linux/arm64) and unknown/unknown entries, which the next section explains. Lower down, a manifest leads to its configuration (the image's launch sheet) and to its layers (the files). Digests are shortened to eight characters.

Reading chain of the alpine 3.24.2 image: the index 294b683c references by digest the linux/amd64 manifest d56c381f, the linux/arm64 v8 manifest 260479a1 and an attestation 350f747a that points by annotation to the amd64 manifest; the amd64 manifest references the config 320994c3 and the tar+gzip layer e2de9651; the arm64 manifest references its own layer a9986cd6.digestdigestdigestannotationdigestdigestdigestOCI index of tag 3.24.2294b683clinux/amd64 manifestd56c381flinux/arm64 v8 manifest260479a1unknown/unknown attestation350f747aamd64 config320994c3amd64 layere2de9651arm64 layera9986cd6EntryComponentExternalStorageFlowExternalData
Each solid arrow is a reference by digest; the dotted line is an annotation. The thirteen other entries of the index are not drawn, and only the arm64 layer is shown on the arm64 side. Source · SVG
Esc to close, + and − to zoom, scroll to move around. 100 %

The lesson goes down this chain in order. The tag appears only at the top: everything below it is identified by digest alone, and that is what makes verification possible.

Does a tag point to an index or to a manifest?

A tag points to either a manifest or an index, and you find out by asking the registry for the raw document with skopeo inspect --raw. The mediaType field of this document says which type it is, without downloading anything else.

Here the tag is deliberately alone (alpine:3.24.2, no digest), because it is the one you are trying to resolve. The docker:// prefix tells skopeo that the source is a registry. The commands save the document into /tmp/index.raw, then extract the key information from it.

Terminal window
REF=docker://docker.io/library/alpine:3.24.2 # tag only: it is the one we resolve
skopeo inspect --raw "$REF" > /tmp/index.raw
jq '{schemaVersion, mediaType, nb: (.manifests|length)}' /tmp/index.raw

The output must show the mediaType application/vnd.oci.image.index.v1+json and "nb": 16: the tag therefore designates an OCI index of sixteen entries. To list them:

Terminal window
jq -r '.manifests[] | "\(.platform.architecture)\t\(.platform.variant // "-")\t\(.platform.os)\t\(.mediaType)\t\(.digest)"' /tmp/index.raw

Excerpt of the output (the intermediate entries are omitted):

amd64 - linux application/vnd.oci.image.manifest.v1+json sha256:d56c381f961d307a21b3ca004cf1e3910f106644aefb1f43e654c8a56c4fd395
unknown - unknown application/vnd.oci.image.manifest.v1+json sha256:350f747a86e8774d359a4f452dec12a2585e73bf072e71c5f628455843b88c71
arm v6 linux application/vnd.oci.image.manifest.v1+json sha256:d3c3fda3e4d3f0fcfc86cf469c6dfbe65017143dde23feb4b11df37c373cdc76

There are eight platforms (amd64, arm in v6 and v7, arm64 in v8, 386, ppc64le, riscv64, s390x), each followed by an unknown/unknown entry. These entries are attestation manifests, not images: their vnd.docker.reference.type annotation is attestation-manifest, and vnd.docker.reference.digest gives the digest of the manifest they attach to. For the first one, it is sha256:d56c381f…, the amd64 manifest. Since their platform matches no machine, a client that resolves the index does not pick them as an image to run.

How do you recompute the digest of an index?

A document's digest is the sha256 of its raw bytes, as the registry serves them, and nothing else (the specification allows other algorithms, such as sha512; Docker Hub uses sha256). You can therefore recompute it yourself and compare it with the one the registry announces: if they match, the document you received is exactly the one that bears this name.

Terminal window
skopeo inspect --format '{{.Digest}}' "$REF"
sha256sum /tmp/index.raw

Both commands must print the same fingerprint, 294b683cb724975bec92580e1e685676bd4b50bda910ddb8c51d4cabeaec77e6, the first one prefixed with sha256:. The fingerprint announced by the registry and the one you compute on the saved file are identical.

"Raw bytes" means that every space and every line break counts. If you ran this file through jq . to make it readable, then computed the sha256 of the result, you would get another fingerprint: the bytes would no longer be the same. The digest designates the bytes of the document, not the meaning of the JSON. So save the document as it is, and read it with jq without ever rewriting the original.

Keep this digest in a variable: it will serve as the address for the copy.

Terminal window
INDEX_DIGEST=sha256:$(sha256sum /tmp/index.raw | cut -d' ' -f1)
echo "$INDEX_DIGEST"

Why do two architectures give two manifests?

Each platform has its own manifest, with its own layers, because the binaries of an amd64 image do not run on an arm64 machine. The index holds no file: it points to the right manifest. The loop below fetches both manifests by their digest, recomputes their sha256 and prints their layers.

Terminal window
for a in amd64 arm64; do
D=$(jq -r --arg a $a '.manifests[] | select(.platform.architecture==$a) | .digest' /tmp/index.raw)
echo "$a -> $D"
skopeo inspect --raw "docker://docker.io/library/alpine@$D" | sha256sum
skopeo inspect --raw "docker://docker.io/library/alpine@$D" | jq -c '{layers: [.layers[].digest]}'
done

For each architecture, the output must show a sha256sum identical to the digest sought, then the list of layers:

amd64 -> sha256:d56c381f961d307a21b3ca004cf1e3910f106644aefb1f43e654c8a56c4fd395
d56c381f961d307a21b3ca004cf1e3910f106644aefb1f43e654c8a56c4fd395 -
{"layers":["sha256:e2de96513ba9eb53b431787ec8a65cdde380ac4772a3e4c4b714dcfde2a102b5"]}
arm64 -> sha256:260479a1cfaf304c4c20da7f8405d3ce313513dcd534bb743257bdd2fe0f3e2d
260479a1cfaf304c4c20da7f8405d3ce313513dcd534bb743257bdd2fe0f3e2d -
{"layers":["sha256:a9986cd6f37dbddae7862a6d4be71683472e7c2ea708e87db14f8a6393c00f00"]}

Two manifests, two digests, two different layers. For each one, the digest named is indeed the sha256 of the document received, as for the index.

A trap awaits if you look for an architecture's digest with --override-arch: the option does select the architecture presented, but the .Digest field stays that of the index:

Terminal window
skopeo inspect --override-arch arm64 --format '{{.Digest}} {{.Architecture}}' "$REF"

The output shows sha256:294b683c… arm64: the architecture is arm64, but the digest is that of the index, not that of the arm64 manifest. For a platform's digest, read it in the index as above.

How do you copy an image by digest into a local layout?

To open the image flat, copy it into an OCI layout: a folder whose organization is standardized by the OCI specification and that any tool can read. The command is skopeo copy, with docker:// for the source and oci: for the destination.

The source is written by digest, without a tag. Skopeo 1.18 refuses to combine the two: the command skopeo inspect --format '{{.Digest}}' "docker://docker.io/library/alpine:3.24.2@$INDEX_DIGEST" stops on Docker references with both a tag and digest are currently not supported. You therefore write alpine@sha256:…, and the tag 3.24.2 appears only on the destination side.

Terminal window
mkdir -p /srv/oci
skopeo copy --override-arch amd64 \
"docker://docker.io/library/alpine@$INDEX_DIGEST" oci:/srv/oci:3.24.2

The --override-arch amd64 option indicates which platform to extract from the index. Skopeo copies the layer and the configuration, then writes the manifest. The output must show:

Getting image source signatures
Copying blob sha256:e2de96513ba9eb53b431787ec8a65cdde380ac4772a3e4c4b714dcfde2a102b5
Copying config sha256:320994c3b997e2ec6433f717f153e108023c5bec8fefa8d76b83451d16d05ea8
Writing manifest to image destination

Here is what the folder now contains:

  • Répertoiresrv/
    • Répertoireoci/
      • Répertoireblobs/
        • Répertoiresha256/
          • 320994c3b997e2ec6433f717f153e108023c5bec8fefa8d76b83451d16d05ea8
          • d56c381f961d307a21b3ca004cf1e3910f106644aefb1f43e654c8a56c4fd395
          • e2de96513ba9eb53b431787ec8a65cdde380ac4772a3e4c4b714dcfde2a102b5
      • index.json
      • oci-layout

The blobs/sha256/ folder is the store: every object in it is a blob (a binary file), named by the sha256 of its content. There are three: the configuration (320994c3…), the amd64 manifest (d56c381f…) and the layer (e2de9651…). The registry's index was not stored: skopeo resolved it and kept only the manifest of the requested platform. The oci-layout file contains only the format version:

{"imageLayoutVersion":"1.0.0"}

How do you follow the chain in the local layout?

The entry point of a layout is index.json, a small local index that associates a name with a manifest. From there, each step is a jq on the blob whose name has just been read: this is the chain of the diagram, walked by hand. In the commands, cut -d: -f2 removes the sha256: prefix from a digest to get the file name.

Terminal window
jq . /srv/oci/index.json

The output must show a single entry: digest is sha256:d56c381f…, size is 1022, and the org.opencontainers.image.ref.name annotation is 3.24.2. This is where the tag survives: as a simple local label placed on the manifest. Open this manifest:

Terminal window
M=$(jq -r '.manifests[0].digest' /srv/oci/index.json | cut -d: -f2)
jq . /srv/oci/blobs/sha256/$M

The output, shortened to the useful fields, shows:

{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"config": {
"mediaType": "application/vnd.oci.image.config.v1+json",
"digest": "sha256:320994c3b997e2ec6433f717f153e108023c5bec8fefa8d76b83451d16d05ea8",
"size": 611
},
"layers": [
{
"mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"digest": "sha256:e2de96513ba9eb53b431787ec8a65cdde380ac4772a3e4c4b714dcfde2a102b5",
"size": 3849738
}
]
}

The manifest designates one configuration and a single layer of 3,849,738 bytes, in tar+gzip format (a compressed tar archive). It also carries annotations not reproduced here, including org.opencontainers.image.version (3.24.2) and org.opencontainers.image.source, which gives the Git repository and the commit the image was built from. The configuration blob is read the same way:

Terminal window
C=$(jq -r '.config.digest' /srv/oci/blobs/sha256/$M | cut -d: -f2)
jq '{architecture, os, config, rootfs, history}' /srv/oci/blobs/sha256/$C

The output, shortened, contains:

{
"architecture": "amd64",
"os": "linux",
"config": {
"Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],
"Cmd": ["/bin/sh"],
"WorkingDir": "/"
},
"rootfs": {
"type": "layers",
"diff_ids": ["sha256:74d97c428c51a828f9051a7a40a53ff1fc99e54fc30323ce36760701b0b7f711"]
},
"history": [
{"created_by": "ADD alpine-minirootfs-3.24.2-x86_64.tar.gz / # buildkit"},
{"created_by": "CMD [\"/bin/sh\"]", "empty_layer": true}
]
}

The configuration is the image's launch sheet: the architecture, the system, the PATH variable, the default command /bin/sh and the working directory /. The diff_ids field is the fingerprint of the decompressed layer, explained in the next section.

The history keeps a trace of the steps that built the image: a first step that adds Alpine's minimal filesystem and produces the layer, then a step marked empty_layer, which only changes the configuration (the default command) without producing a layer. What remains is to open the layer. tar -tzf lists the content of a compressed tar archive without extracting it, head -8 keeps the first eight lines and wc -l counts lines:

Terminal window
Lyr=$(jq -r '.layers[0].digest' /srv/oci/blobs/sha256/$M | cut -d: -f2)
tar -tzf /srv/oci/blobs/sha256/$Lyr | head -8
tar -tzf /srv/oci/blobs/sha256/$Lyr | wc -l

The output starts with bin/, bin/arch, bin/ash, bin/base64, bin/bbconfig, bin/busybox, bin/cat and bin/chattr, then the count is 515. The layer therefore holds 515 entries: this is Alpine's filesystem. With the configuration, you have read the whole content of the image.

Why does a layer carry two fingerprints?

A layer is designated by two different fingerprints because it is hashed at two moments: compressed for transport, decompressed for its content. The digest, in the manifest, is the sha256 of the compressed archive as you download it; the diff_id, in the configuration, is the sha256 of the same archive once decompressed.

The digest serves to verify the download: a registry only knows the compressed file it stores. The diff_id identifies the content independently of the compression: two tools that compressed the same files differently would produce two digests, but a single diff_id. Compute both and compare with the configuration. zcat decompresses the file to the output without modifying it, and cut -c1-64 keeps only the 64 characters of the fingerprint:

Terminal window
echo "digest : $(sha256sum /srv/oci/blobs/sha256/$Lyr | cut -c1-64)"
echo "diff_id: $(zcat /srv/oci/blobs/sha256/$Lyr | sha256sum | cut -c1-64)"
echo "config : $(jq -r '.rootfs.diff_ids[0]' /srv/oci/blobs/sha256/$C)"

The output must show e2de96513ba9… for the digest, 74d97c428c51… for the recomputed diff_id, and the same value sha256:74d97c428c51… in the configuration. The first is the name of the layer file, the second the value of rootfs.diff_ids[0]: the two are not interchangeable.

How do you verify all the blobs at once?

Since each blob is named by the sha256 of its content, a short loop checks the whole layout: for each file, it recomputes the fingerprint and compares it with the file name.

Terminal window
cd /srv/oci/blobs/sha256
for f in *; do
s=$(sha256sum "$f" | cut -c1-64)
[ "$s" = "$f" ] && echo "OK $f" || echo "KO $f"
done

The output must show three OK lines, one per blob: 320994c3…, d56c381f… and e2de9651…. A KO would flag a corrupted or modified file.

The loop answers you now, on this machine. For someone to verify the same layout later, elsewhere, you hand over a receipt instead: a file in sha256sum format, one line per blob, which they replay with sha256sum -c. Produce it from the root of the layout, so that its paths start with blobs/sha256/:

Terminal window
cd /srv/oci
sha256sum blobs/sha256/* > /srv/oci.sha256
sha256sum -c /srv/oci.sha256

The verification prints one line per blob, each ending with OK:

blobs/sha256/320994c3b997e2ec6433f717f153e108023c5bec8fefa8d76b83451d16d05ea8: OK
blobs/sha256/d56c381f961d307a21b3ca004cf1e3910f106644aefb1f43e654c8a56c4fd395: OK
blobs/sha256/e2de96513ba9eb53b431787ec8a65cdde380ac4772a3e4c4b714dcfde2a102b5: OK

A receipt is replayed from the folder where it was produced. Produced from blobs/sha256/, it contains only the file names. Replayed from the root of the layout, it no longer finds them: each line prints No such file or directory then FAILED open or read, and sha256sum ends with WARNING: 3 listed files could not be read. Leave that folder before continuing, for example with cd /, so you do not run the rest from the layout.

What happens when you alter a byte?

A modified blob, even by a few characters, no longer has the fingerprint of its name, and a tool that verifies digests refuses it. This is what content addressing brings: whoever pins a digest detects any change to the content behind it.

Try it on a copy of the layout, replacing the default command /bin/sh with /bin/xx in the configuration. sed -i makes this replacement directly in the file. The two strings have the same length: no size difference gives the modification away, only the fingerprint detects it.

Terminal window
rm -rf /srv/oci-altere && cp -a /srv/oci /srv/oci-altere
CF=/srv/oci-altere/blobs/sha256/$C
chmod u+w "$CF"
sed -i 's#/bin/sh#/bin/xx#' "$CF"
sha256sum "$CF" | cut -c1-64
echo "$C"

The chmod is only a precaution: after skopeo copy, the blobs are -rw-r--r-- (0644) and belong to whoever copied, so they can be modified by that account without chmod. On a layout copied by another account, they may not be writable.

The first line of the output is a new sha256, a321159d01c5c8b73e647b3c62f7ca5097bb669afd0b7a26f95a7e19b473d8e5; the second is the file name, still 320994c3…. The content no longer matches the name. Now have two tools read this image.

Terminal window
skopeo copy oci:/srv/oci-altere:3.24.2 dir:/tmp/copie
umoci unpack --image /srv/oci-altere:3.24.2 /tmp/bundle-altere

The first command, skopeo copy, stops with a fatal message (exit code 1) that ends with Download config.json digest sha256:a321159d… does not match expected sha256:320994c3…. The second, umoci unpack, the tool that turns a layout into a runnable folder, answers expected sha256:320994c3… not sha256:a321159d…: verified reader digest mismatch. Both refuse, and the message quotes both fingerprints: the one the manifest promised, the one the file produces.

The same reasoning protects the whole chain. The manifest contains the digest of the configuration and of the layers; the index, or the pinned reference, contains the digest of the manifest. Modifying one link changes its fingerprint, and therefore breaks the reference of the link above it, all the way up to the digest you pinned. A tag, by contrast, is not a fingerprint: the registry can make it point to another image, and nothing in the tag signals it.

Read a multi-architecture Docker image pinned by digest Exercise 1 of 1 · ~10 min · terminal

You have read alpine:3.24.2. Now do the same walk-through on another image, traefik/whoami in version v1.11.0, a small web server written in Go. You start from this image's index, designated by its digest sha256:200689790a0a0ea48ca45992e0450bc26ccab5307375b41c84dfc4f2475937ab. As with Alpine, skopeo refuses to write the tag and the digest together: the source is written whoami@sha256:….

Read the index and recompute its digest

Save the raw index document into /tmp/whoami.raw, compute its sha256sum and compare it with the digest above. Then read its mediaType and the number of entries in .manifests with jq.

Find the arm64 manifest and count its layers

Extract the digest of the arm64 platform from the index, then read the matching manifest with skopeo inspect --raw to count its layers.

Copy this platform and verify the layout

Copy the arm64 image into /srv/whoami with the local tag v1.11.0. Run the loop from the section "How do you verify all the blobs at once?" on the /srv/whoami/blobs/sha256 folder: it prints one line per blob. Then compare the digest that index.json gives your manifest with the one you extracted from the registry's index.

A hint 1 / 1

A platform's manifest is a blob like any other: the digest you read in the registry's index should be found, or not, among the file names of the layout.

I have tried: show the solution
Terminal window
REF=docker://docker.io/traefik/whoami@sha256:200689790a0a0ea48ca45992e0450bc26ccab5307375b41c84dfc4f2475937ab
skopeo inspect --raw "$REF" > /tmp/whoami.raw
sha256sum /tmp/whoami.raw
jq '{mediaType, nb: (.manifests|length)}' /tmp/whoami.raw
D=$(jq -r '.manifests[] | select(.platform.architecture=="arm64") | .digest' /tmp/whoami.raw)
echo "$D"
skopeo inspect --raw "docker://docker.io/traefik/whoami@$D" | jq '.layers | length'
mkdir -p /srv/whoami
skopeo copy --override-arch arm64 "$REF" oci:/srv/whoami:v1.11.0
jq -r '.manifests[0].digest' /srv/whoami/index.json
ls /srv/whoami/blobs/sha256 | wc -l

On the tested VM (Debian 13, skopeo 1.18.0), the sha256sum gives 200689790a0a…, the digest of the reference. The mediaType is application/vnd.docker.distribution.manifest.list.v2+json and nb is 3: this image has no OCI index, it publishes a manifest list in Docker format, with three platforms (amd64, arm64 and arm in v7). The arm64 manifest is sha256:c2c89736… and skopeo inspect --raw counts 3 layers.

After the copy, index.json designates sha256:376ac66a672b706cb13db3a0e4e4e2baade77427484ee6139ff9d5cbb256e428, which is not c2c89736…. The blobs/sha256 folder contains 5 files: the three layers, the configuration and the manifest. The verification loop prints five OK lines.

The manifest's digest changed because skopeo converted the Docker manifest into an OCI manifest during the copy: the layers keep their digest (24f32500…, 13615ce8…, af0649a3…), but the configuration goes from ab541801… to 87fc5ea8… and the manifest is rewritten. The layout is consistent, each file does bear the fingerprint of its name, but this manifest is no longer the one the registry serves under the pinned digest. To get the exact bytes the registry serves, read the document with skopeo inspect --raw, as in the first command.

What about crane, oras or CI?

The same operations exist in other tools: crane (crane manifest, crane config, crane digest) and oras read a registry like skopeo, without a daemon. The guides Crane and Skopeo detail their options. The principle does not change: a document, its sha256, then the next reference.

In production, this verification becomes a working rule: pin images by digest, store the digest at build time and redeploy it as it is. Pin a base image, and deliver it offline shows how to read and pin a digest. Share the build cache in CI, and promote an image between registries shows how to promote an image along with its digest.

The lesson Check what an image contains, and who signed it scans an image and verifies the signature of an archive, two checks that assume you know exactly which image you are designating. The layout you have at hand is not runnable yet: the lesson Run an OCI bundle with runc turns it into a bundle and launches it with a runtime.

Troubleshooting

These errors almost all come from a skopeo syntax detail, or from the intended refusal of a tampered image: in the latter case, the error is the expected answer.

SymptomCauseFix
Docker references with both a tag and digest are currently not supportedskopeo 1.18 refuses an image:tag@sha256:… referenceWrite docker://docker.io/library/alpine@sha256:… without the tag; the tag goes on the destination (oci:/srv/oci:3.24.2)
skopeo inspect --override-arch arm64 --format '{{.Digest}}' returns the index's digest--override-arch changes the platform presented, not the .Digest fieldRead the platform's digest in the index with jq
A document's sha256sum does not match the announced digestThe document was reformatted (jq ., editor) before the computation: the bytes are no longer the registry'sSave the output of skopeo inspect --raw as it is and compute on that
The layer's sha256sum differs from the config's diff_idNormal behavior: one hashes the compressed archive, the other the decompressed archiveCompare the diff_id with zcat layer | sha256sum
Download config.json digest … does not match expected … (skopeo copy)The configuration blob no longer carries the fingerprint of its nameCopy again from the registry; do not bypass the verification
verified reader digest mismatch (umoci unpack)Same cause, detected when the blob is readSame: a modified blob is replaced, not accepted
The digest in index.json is not that of the manifest read in the registry's indexThe image is published in Docker format: skopeo converted it to OCI during the copy, the manifest was rewrittenNormal as long as the verification loop prints OK; for the registry's bytes, skopeo inspect --raw
KO in the verification loopFile corrupted or modified since the copyDelete the layout and run skopeo copy again

Put it into practice

The lab runs on a Debian 13 with no container engine, with skopeo, jq and umoci. You copy busybox 1.37.0 by its digest into a local layout, you read the digest of the linux/amd64 manifest, then you examine a layout received from elsewhere in which a file was modified without changing its size. The validation recomputes the fingerprint of every blob in your layout and checks that you named the altered blob, drawn at random on each reset.

Key points

  • A tag can designate an index (several platforms) or a manifest: skopeo inspect --raw and the mediaType field tell which.
  • A document's digest is the sha256 of its raw bytes: skopeo inspect --format '{{.Digest}}' and sha256sum on the --raw output agree, while a jq . does not preserve the fingerprint.
  • Each platform has its own manifest and layers; the unknown/unknown entries of an index are attestations, not images.
  • --override-arch does not change the .Digest field: it stays that of the index. With skopeo 1.18, a source is written alpine@sha256:…, without a tag.
  • An OCI layout contains oci-layout, index.json and blobs/sha256/, one file per object, named by the sha256 of its content.
  • The chain is followed by hand: index.json, manifest, configuration (Cmd, Env, diff_ids, history), layer (tar -tzf).
  • A layer has two fingerprints: the digest (compressed, in the manifest) and the diff_id (decompressed, in the configuration).
  • A sha256sum receipt of the blobs can be handed over and replayed with sha256sum -c, from the folder where it was produced.
  • A modified byte changes the fingerprint: skopeo copy and umoci unpack refuse the image; a pinned digest makes any modification of the content detectable.
  • For an image published in Docker format, skopeo copy to an OCI layout rewrites the manifest: its digest is no longer the registry's, but each blob keeps the fingerprint of its name.

Knowledge check

This quiz asks six questions drawn from ten. It checks that you can read an index, recompute a digest and explain why a tampered image is refused.

Knowledge check

Check what you have learned with this interactive quiz

6 questions
6 min
70% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer