Sub topic 1
Why image supply chain metadata matters
Prerequisites
This chapter assumes you can do the following:
- Write a basic Dockerfile and run
docker build. - Push images to a container registry.
- Read image tags and digests, and recognize a multi-platform image.
- Read JSON on the command line, for example with
jq.
You don't need to know BuildKit internals yet. Later chapters cover them.
The problem: an image is opaque
A container image is a stack of filesystem layers plus a small configuration file. When you pull registry.example.com/demo/app:1.0, you can run it. You can't easily answer two questions about it:
- What software is inside it?
- How, where, and from what source was it built?
Teams usually find out that they need those answers during an incident. When a critical vulnerability appears in a widely used library, someone must find every deployed image that contains it. When a build system is suspected of compromise, someone must decide which images it produced. Without recorded metadata, both tasks mean guessing or pulling and unpacking images one by one.
Where trust gets lost
An image passes through several steps before it runs in production. Each step can introduce a risk.
Three examples show the risks:
- Dependencies. The Dockerfile below installs one package, but that package pulls in others. The resulting list is longer than the one line you wrote.
- Base images. A tag such as
alpine:3.20can point to different content over time. Rebuilding next week may give you different packages. - Build environment. The same Dockerfile built on a laptop and in CI can produce different images. A registry stores only the result, not the story of how it was made.
FROM alpine:3.20
RUN apk add --no-cache curl
CMD ["curl", "--version"]Here curl brings in libraries such as TLS and compression packages. None of them appear in the Dockerfile. Only the finished image or its metadata shows them.
Two kinds of metadata
Supply chain metadata is data about an image, stored and shipped with it. This tutorial focuses on two kinds.
| Metadata | Answers | Typical use |
|---|---|---|
| SBOM (Software Bill of Materials) | What components are inside the image? | Find images affected by a new vulnerability, check licenses |
| Provenance | How was the image built, from which source, by which builder? | Audit builds, check that an image came from the expected pipeline |
An SBOM describes the contents of the image. Provenance describes how it was made. Neither one tells you whether the image is safe. They are inputs to decisions, not decisions themselves.
Why generate it at build time
You could scan a finished image later and reconstruct a package list. That approach has limits. The scanner sees only the final filesystem, so it misses information that exists only during the build, such as the source repository, the build arguments, and the base image digest. Build tools see all of these inputs while they work, so they can record them accurately.
BuildKit, the build engine behind Docker, can record both kinds of metadata during a build and attach them to the image. Later chapters show how.
Common mistakes
- Treating an SBOM as a vulnerability report. An SBOM lists components. A separate scanner compares that list against vulnerability databases.
- Assuming metadata proves integrity. Unsigned metadata can be replaced or forged by anyone who can write to the registry. The final chapters cover signing and verification.
- Recording more than you intend. Provenance can include build arguments and other details. Treat it as data that may leave your organization.
Exercise
A new vulnerability is announced in a library. Why is an SBOM generated at build time more useful than unpacking each deployed image, and what does the SBOM still not tell you?
Show answer
With SBOMs stored alongside the images, you can query the recorded component lists and find affected images without pulling and inspecting each one. The SBOM does not say whether the vulnerability is exploitable in your setup, and it does not prove the SBOM itself is authentic unless it is signed and verified.