Sub topic 10
Choosing provenance mode min or max
This chapter assumes you can build and push an image with docker buildx build. It also assumes you know what a provenance attestation is and where it is stored in the image index, as covered in earlier chapters. Here you will compare the two provenance modes, min and max, and choose one deliberately.
What the modes control
A provenance attestation describes how an image was built. The mode sets how much detail BuildKit records.
minrecords the basics: the build platform, the builder, the source repository and revision when known, and the digests of the inputs. It leaves out build arguments and the Dockerfile content.maxrecords everything inmin. It also records the full Dockerfile source, the values of build arguments, the build steps (the LLB graph), and the metadata BuildKit collected during the build.
If you pass --provenance=true or --attest type=provenance with no mode, BuildKit uses min for images exported to a registry. The default can differ with the exporter and version, so set the mode explicitly in pipelines.
docker buildx build \
--provenance=mode=max \
--tag registry.example.com/demo/app:1.0 \
--push .The --attest form is equivalent and accepts the same options.
docker buildx build \
--attest type=provenance,mode=min \
--tag registry.example.com/demo/app:1.0 \
--push .Comparing the two
| Property | `min` | `max` |
|---|---|---|
| Builder and platform | Yes | Yes |
| Source repository and revision | Yes | Yes |
| Build argument values | No | Yes |
| Full Dockerfile source | No | Yes |
| Build step graph | No | Yes |
| Size of the attestation | Small | Larger |
| Risk of leaking data | Low | Higher |
Avoiding leaks with max mode
Max mode stores build argument values in plain text inside the image index. Anyone who can pull the image can read them. A value passed with --build-arg is therefore exposed, even if the Dockerfile never copies it into a layer.
Check this before you enable max on images that other people can pull. Look for tokens, internal hostnames, and private repository URLs in build arguments.
You can check what a build recorded by inspecting the result.
docker buildx imagetools inspect registry.example.com/demo/app:1.0 \
--format '{{ json .Provenance }}' | jq .With max, the output includes the build arguments and the Dockerfile content. With min, those fields are absent.
When to choose each mode
Choose max when you need an audit trail. It lets you reproduce a build, review exactly what ran, and feed richer data to policy tools. It suits private registries and internal images.
Choose min when the image is public, when build arguments carry sensitive values, or when attestation size matters. It still identifies the builder and the source, which covers many SLSA-style checks.
You can also turn provenance off when a registry or consumer cannot handle the extra manifests in the index.
docker buildx build \
--provenance=false \
--tag demo/app:no-provenance \
--push .Turning provenance off removes the metadata, so use it only as a compatibility workaround.
Common errors
- Assuming the default is
max. Set the mode explicitly. Otherwise you may get less detail than you expect. - Publishing
maxprovenance for public images. This can expose build arguments and Dockerfile contents. - Comparing modes on a locally loaded image. The classic Docker image store cannot hold attestations. Push to a registry, or use an exporter that supports them.
Exercise
A public image is built with --build-arg INTERNAL_API=https://api.corp.example. Which provenance mode would expose that value, and what should you do?
Show answer
Mode max records build argument values, so the URL would be readable by anyone who pulls the image. Use --provenance=mode=min for the public image, and pass any truly sensitive value with --secret instead of --build-arg.