buildx replay
buildx replay lets users rebuild an image on their own instead of trusting a
published artifact. Replaying from the same pinned materials makes it possible
to verify that the artifact was actually built from the sources recorded in
provenance, and a separate verification attestation makes it possible to
express stronger source policies based on independent rebuilds.
This can replace the current manual snapshotting of source files in DHI pipeline.
Scope
Replay targets release builds from remote sources. Builds that used local
directory context are not supported because local sources are not recorded in
provenance materials. Replay requires that provenance was captured with
sufficient completeness for the requested replay mode.
Commands
docker buildx replay build [flags] <subject> -o ...
docker buildx replay snapshot [flags] <subject> -o ...
docker buildx replay verify [flags] <subject> -o ...
Subject input
All commands take one positional subject argument.
Supported forms:
docker-image://...
oci-layout://...
- local attestation file, for example
.sigstore.json
Resolution rules:
- If the input is an image or OCI layout, replay loads provenance attached to
that subject.
- If the input is a local file, replay expects an attestation document and
loads provenance from it.
replay build
Replay a build from provenance and produce a normal build result.
Usage:
docker buildx replay build [flags] <subject> -o ...
Flags:
Behavior:
- Reconstruct the build according to
-replay-mode.
- Resolve materials according to
-materials.
- Export the rebuilt result via
-output.
- Default mode is faithful replay from pinned materials.
- Fail if provenance is insufficient for the requested replay mode.
- Fail if the original build used secrets or SSH and the corresponding
-secret or -ssh flags are not provided.
Examples:
docker buildx replay build --replay-mode=materials docker-image://example/app:latest -o type=oci,dest=result.oci
docker buildx replay build --materials=./materials --network=none docker-image://example/app:latest -o type=docker
replay snapshot
Preserve replay inputs for later rebuilds, even if original sources change or
disappear.
Usage:
docker buildx replay snapshot [flags] <subject> -o ...
Flags:
-include-materials
- Boolean
- Default:
true
- Meaning:
- when true, snapshot immutable source materials together with replay
metadata
- when false, snapshot replay metadata only
-output, -o <output-spec>
- Required
- Supported targets should include:
- local directory
- OCI layout
- registry
Behavior:
- Export replay metadata describing how to replay the build.
- By default also store reusable copies of immutable source materials.
- Output can later be used as a
-materials source for replay build or
replay verify.
Examples:
docker buildx replay snapshot docker-image://example/app:latest -o type=oci,dest=replay
docker buildx replay snapshot --include-materials=false docker-image://example/app:latest -o type=registry,ref=example/app-replay:meta
replay verify
Replay a build, compare the result, and emit a verification result.
Usage:
docker buildx replay verify [flags] <subject> -o ...
Flags:
-materials=<source>
- Same meaning as in
replay build
-network=<mode>
- Same meaning as in
replay build
-secret
- Same meaning as in
replay build
-ssh
- Same meaning as in
replay build
-platform=<platform>
- Verify only the specified platform from a multi-platform build
- Default: verify all platforms recorded in provenance
-compare=<mode>
- Values:
- Default:
digest
- Meaning:
digest: exact output digest match
artifact: compare image manifest digests
semantic: reserved for future higher-level comparison
-output, -o <output-spec>
- Writes verification result or attestation
Behavior:
- Replay the build using the same replay-relevant attributes and same materials
as the original provenance.
- Compare replay result against expected artifact.
- Emit a verification result suitable for saving or pushing.
- On failure, report where the output diverged (layer, config, or manifest
level).
- Verification attestation may be signed by external tooling.
- Resulting verification evidence can later be used by source policy.
Examples:
docker buildx replay verify --materials=./materials docker-image://example/app:latest -o type=local,dest=./verify
docker buildx replay verify --network=none docker-image://example/app:latest -o type=registry,ref=example/app:verify
Replay metadata
Replay snapshot output should contain:
- provenance-derived replay instructions
- source material descriptors
- enough metadata to drive
replay build and replay verify
Default policy
- strict by default
- faithful replay uses pinned materials
- missing required material data is an error
- fallback to weaker replay modes must be explicit
Verification rules
- Verification is only valid when replay uses the same replay-relevant
attributes and the same materials as recorded in the original provenance.
- If replay uses different attributes or different materials, it is not a
verification of the original build.
- Digest comparison requires the same
compatibility-version as the original
build. The effective compatibility-version is recorded in provenance.
- If the replay requires materials that are not part of the original provenance, verification should probably fail by default, but possibly override could be passed.
Security model
- Local materials let the user independently verify source checksums before
running replay.
- If the user then disables network, they know source inputs used by the replay
must come from those verified local materials.
Verification output
- Verification output should be representable as an attestation.
- Target predicate type is SLSA Verification Summary Attestation (VSA); exact
predicate fit needs investigation to confirm replay-specific fields
(replay mode, materials source, comparison method, compatibility-version)
are representable.
- It should be possible to save it locally or push it remotely via
-output.
- Signing remains external to replay itself.
Non-goals
- hermetic build guarantees
- semantic comparison in the first version
@AkihiroSuda @crazy-max
buildx replay
buildx replaylets users rebuild an image on their own instead of trusting apublished artifact. Replaying from the same pinned materials makes it possible
to verify that the artifact was actually built from the sources recorded in
provenance, and a separate verification attestation makes it possible to
express stronger source policies based on independent rebuilds.
This can replace the current manual snapshotting of source files in DHI pipeline.
Scope
Replay targets release builds from remote sources. Builds that used local
directory context are not supported because local sources are not recorded in
provenance materials. Replay requires that provenance was captured with
sufficient completeness for the requested replay mode.
Commands
docker buildx replay build [flags] <subject> -o ...docker buildx replay snapshot [flags] <subject> -o ...docker buildx replay verify [flags] <subject> -o ...Subject input
All commands take one positional subject argument.
Supported forms:
docker-image://...oci-layout://....sigstore.jsonResolution rules:
that subject.
loads provenance from it.
replay buildReplay a build from provenance and produce a normal build result.
Usage:
Flags:
-replay-mode=<mode>materialsfrontendllbmaterialsmaterials: replay from pinned source materials recorded in provenancefrontend: replay from the same frontend with the same attributesrecorded in provenance
llb: replay from serialized LLB recorded in provenance; requiresmode=maxprovenance-materials=<source>provenanceoci-layout://...registry://...provenancekey=valueformat in here, and the user could provide direct mapping from a specific material to the snapshot location. This would be used to patch errors if a specific material is causing the build to fail.-network=<mode>defaultnonedefaultfrom the network
noneis useful when materials are local and have been independentlyverified
-secretdocker buildx build --secretsecret is missing
-sshdocker buildx build --sshrequired SSH identity is missing
-platform=<platform>-output, -o <output-spec>buildx buildBehavior:
-replay-mode.-materials.-output.-secretor-sshflags are not provided.Examples:
replay snapshotPreserve replay inputs for later rebuilds, even if original sources change or
disappear.
Usage:
Flags:
-include-materialstruemetadata
-output, -o <output-spec>Behavior:
-materialssource forreplay buildorreplay verify.Examples:
replay verifyReplay a build, compare the result, and emit a verification result.
Usage:
Flags:
-materials=<source>replay build-network=<mode>replay build-secretreplay build-sshreplay build-platform=<platform>-compare=<mode>digestartifactsemanticdigestdigest: exact output digest matchartifact: compare image manifest digestssemantic: reserved for future higher-level comparison-output, -o <output-spec>Behavior:
as the original provenance.
level).
Examples:
Replay metadata
Replay snapshot output should contain:
replay buildandreplay verifyDefault policy
Verification rules
attributes and the same materials as recorded in the original provenance.
verification of the original build.
compatibility-versionas the originalbuild. The effective
compatibility-versionis recorded in provenance.Security model
running replay.
must come from those verified local materials.
Verification output
predicate fit needs investigation to confirm replay-specific fields
(replay mode, materials source, comparison method, compatibility-version)
are representable.
-output.Non-goals
@AkihiroSuda @crazy-max