Sub topic 7
Builder drivers and registry requirements
This chapter assumes you can run docker buildx build, push to a registry, and read the output of docker buildx ls. Attestations need two things to work: a builder that can produce them, and a destination that can hold them. If either is missing, the build fails or the attestations silently disappear.
Which builder drivers can produce attestations
A Buildx builder runs on a driver. The driver decides where BuildKit runs and what output formats it can store.
| Driver | Attestations | Notes |
|---|---|---|
| `docker` with the classic image store | No | The classic store cannot hold an image index with attestation manifests. |
| `docker` with the containerd image store | Yes | The store understands multi-manifest images. |
| `docker-container` | Yes | Runs BuildKit in its own container. Common choice for CI. |
| `kubernetes` | Yes | Runs BuildKit in pods. |
| `remote` | Yes | Connects to an existing BuildKit daemon. |
The default builder uses the docker driver. If your Docker Engine uses the classic image store, --sbom and --provenance=mode=max will not give you a usable result. The simplest fix is to create a dedicated builder:
docker buildx create --name attest-builder --driver docker-container --use
docker buildx inspect --bootstrap--bootstrap starts the builder so you can see its driver and the BuildKit version it runs. Attestation support needs a recent BuildKit, so check that version if a build ignores your flags.
flowchart TDThe next diagram shows the decision path.
Output targets
Attestations travel with the image only when the target can store an index.
- Push to a registry (
--push) keeps the image and its attestations together. This is the main path in this tutorial. - Local or tar export (
--output type=local,dest=out) writes attestations as JSON files beside the exported filesystem. --loadinto the classic store keeps only the image. The attestations are dropped, because that store holds single-platform images, not indexes.
Because of the last case, a build that works with --push may show no attestations after --load. Nothing is broken. The target cannot store them.
Registry requirements
A registry must accept OCI image indexes and artifacts that use OCI media types. Docker Hub, GitHub Container Registry, Amazon ECR, Google Artifact Registry, Azure Container Registry, and the open source registry:2 all accept them.
Attestations are stored as extra manifests in the index. Most registry user interfaces show them as an unknown/unknown platform entry. This is expected. A few older or restricted registries reject these manifests, and some tools mishandle indexes that contain unexpected entries.
If a push fails or a consumer cannot read the image, you can turn off provenance while you investigate:
docker buildx build \
--provenance=false \
--tag demo/app:no-provenance \
--push .Use this as a diagnostic or a short-term workaround. Turning off provenance removes information consumers may rely on, so restore it once the registry or tool is fixed.
Verify your setup
Run a small push, then read the SBOM back from the registry:
docker buildx build \
--sbom=true \
--provenance=mode=max \
--tag registry.example.com/demo/app:1.0 \
--push .
docker buildx imagetools inspect registry.example.com/demo/app:1.0 \
--format '{{ json .SBOM }}'If the second command prints JSON with a package list, the builder and registry both work. If it prints nothing, check the driver first, then the output target.
Exercise
Your CI job runs docker buildx build --sbom=true --load . on the default docker driver with the classic image store. The image runs, but no SBOM is available afterwards. Name two changes that would fix this.
Show answer
Use a builder whose driver supports attestations, such as one created with docker buildx create --driver docker-container. Change the output target to --push to a registry that accepts OCI indexes. Alternatively, export locally with --output type=local to get the SBOM as a file. Loading into the classic store drops attestations because that store cannot hold an image index.