Sub topic 7
Builder drivers and registry requirements
Earlier chapters showed how to switch on SBOM and provenance attestations. This chapter covers the two places where that fails most often: the builder driver you build with, and the registry you push to. It assumes you can run docker buildx build, know what an image index (a manifest list) is, and can read JSON with jq.
Why the driver and registry matter
An attestation is not a separate file that sits beside the image. It is stored as extra manifests inside an image index. Two things must therefore support that layout:
- The builder must be able to produce an image index and run the attestation generators.
- The destination must be able to store an index that contains those extra manifests.
If either one cannot, the build fails with an error or silently drops the attestations. Both cases are easy to diagnose once you know where to look.
Buildx drivers
A Buildx driver decides where BuildKit runs. You choose it when you create a builder with docker buildx create --driver <name>.
| Driver | Where BuildKit runs | Attestation support |
|---|---|---|
| `docker` | Inside the Docker Engine | Only with the containerd image store enabled |
| `docker-container` | A dedicated BuildKit container | Yes |
| `kubernetes` | Pods in a Kubernetes cluster | Yes |
| `remote` | A BuildKit daemon you already run | Yes, if the daemon is recent enough |
The docker driver is the default, so many people hit its limits first.
The default docker driver
The classic Docker Engine image store cannot hold an image index with attestation manifests. With that store, the docker driver rejects the build and tells you to change driver or turn on the containerd image store. Both fixes work.
To check which store your engine uses, run:
docker info -f '{{ .DriverStatus }}'If the output contains io.containerd.snapshotter.v1, the containerd image store is active. If it shows overlay2 or similar, you have the classic store.
On Docker Desktop you can enable the containerd store in the settings. On a plain Linux engine, set it in /etc/docker/daemon.json and restart the daemon:
{
"features": {
"containerd-snapshotter": true
}
}Switching image stores hides images created under the old store. They are not deleted, but you will not see them in docker images until you switch back. Plan for that before you change a shared machine.
The docker-container driver
This driver is the usual choice for CI and for local work if you don't want to change image stores. It starts BuildKit in its own container, so it always has full index and attestation support.
docker buildx create \
--name attest-builder \
--driver docker-container \
--use
docker buildx inspect --bootstrap--bootstrap starts the BuildKit container now instead of on the first build. The inspect output lists the driver, the BuildKit version, and the platforms the builder supports. Check the version here first when attestations misbehave.
The kubernetes and remote drivers
Both drivers talk to a BuildKit daemon that you or your platform team operate. Attestation support depends on the BuildKit version of that daemon, not on your local Buildx. SBOM and provenance generation arrived in BuildKit 0.11, so any daemon older than that cannot produce them, even if your client is new. If a shared builder behaves differently from your laptop, compare docker buildx inspect output for both.
The SBOM scanner needs network access
SBOM generation runs a scanner as a container image inside the build. By default BuildKit uses docker/buildkit-syft-scanner, which it pulls like any other image. This has two consequences:
- The builder must be able to pull that image from its registry. Builders on air-gapped networks or behind a strict egress policy fail at the scan step.
- You can replace the scanner with your own image, for example one you mirror internally.
docker buildx build \
--attest type=sbom,generator=registry.example.com/mirror/buildkit-syft-scanner:stable-1 \
--tag registry.example.com/demo/app:1.0 \
--push .Provenance has no such dependency. BuildKit generates it directly from information it already has.
Exporters: where the output goes
The driver is only half of the picture. The exporter (the --output type) must also be able to carry an index.
| Output | What happens to attestations |
|---|---|
| `--push`, or `type=image` with `push=true` | Stored in the registry inside the image index |
| `type=oci` | Stored in the OCI layout in the archive or directory |
| `type=local` or `type=tar` | Written out as JSON files next to the exported file tree |
| `type=docker`, or `--load` into the classic store | Not supported, because the store cannot hold the index |
For a quick local check without a registry, export to a directory and read the files:
docker buildx build \
--attest type=sbom \
--attest type=provenance,mode=min \
--output type=local,dest=./out .
ls outYou should see the filesystem of the image plus the attestation JSON files. Their exact names vary by Buildx version. For multi-platform builds, each platform gets its own subdirectory.
Registry requirements
A registry stores attestations as ordinary manifests, so it needs no special feature. It must implement the OCI image index (or a Docker manifest list) and accept manifests that the index references. Attestation manifests appear in the index with the platform unknown/unknown and annotations that link them to the image they describe.
You can see this structure directly:
docker buildx imagetools inspect registry.example.com/demo/app:1.0 --raw \
| jq '.manifests[] | {digest, platform, annotations}'For each real image, you should see a second entry with platform unknown/unknown. Its vnd.docker.reference.type annotation is attestation-manifest, and its vnd.docker.reference.digest annotation names the image manifest it describes.
Most large hosted registries accept this layout. Problems tend to come from three places:
- Old or minimal registries that only store single-image manifests and reject indexes.
- Consumers of the image, not the registry itself. Some deploy tools and serverless platforms cannot pull an index with extra entries, or they show the
unknown/unknownentries as strange platforms. - Policies that restrict media types or artifact types, which can refuse the in-toto layers.
If a consumer breaks on the extra manifests, the fix is to disable the attestation that triggers them, as the topic's last example does:
docker buildx build \
--provenance=false \
--tag demo/app:no-provenance \
--push .Disabling is a trade-off. You lose the supply chain metadata for that image, so use it only for destinations that cannot handle attestations, and keep a second, attested tag where you can.
Testing against a local registry
A local registry:2 container is a handy way to confirm that your builder works before you involve a real registry. It has one trap with the docker-container driver. The BuildKit container has its own network namespace, so localhost:5000 inside it is not your host. Give the builder the host network:
docker run -d -p 5000:5000 --name registry registry:2
docker buildx create \
--name local-attest \
--driver docker-container \
--driver-opt network=host \
--use
docker buildx build \
--sbom=true \
--provenance=mode=max \
--tag localhost:5000/demo/app:1.0 \
--push .Without network=host the push fails with a connection error, which looks like a registry problem but is a builder networking problem.
Choosing a path
Common errors and what they mean
- "Attestation is not supported for the docker driver." You are using the classic image store. Switch to
docker-containeror enable the containerd image store. - The build succeeds but
imagetools inspectshows no SBOM. The scan was probably not requested. Provenance can appear by default on a push, but SBOM never does. Pass--sbom=true. - The SBOM step hangs or fails to pull. The builder cannot reach the scanner image. Mirror it and set
generator=. - A deploy tool fails on the pushed tag. The consumer does not accept the index. Build that tag with
--provenance=false, and without--sbomif it also complains. - A push to
localhost:5000fails only withdocker-container. Add--driver-opt network=host.
Exercise
Your team builds with the default docker driver on the classic image store. A pipeline step fails when you add --sbom=true --push. Name two ways to fix it, and say which one leaves your Docker Engine configuration untouched.
Show answer
Either switch to the containerd image store, or create a builder with the docker-container driver and use it for the build. The second option, docker buildx create --driver docker-container --use, leaves the engine configuration untouched. It also avoids hiding existing images behind a different image store.
Exercise
A deploy tool cannot pull registry.example.com/demo/app:1.0, which was pushed with attestations. The same Dockerfile built with --provenance=false works. What in the registry's content explains this, and how can you see it?
Show answer
The tag points to an image index that includes extra manifests with platform unknown/unknown, which hold the attestations. The deploy tool does not handle them. You can see them with docker buildx imagetools inspect registry.example.com/demo/app:1.0 --raw | jq '.manifests[] | {digest, platform, annotations}'.