You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add --source-policy-file flag to nerdctl build
Add support for BuildKit source policies via `nerdctl build --source-policy-file`.
This enables reproducible and policy-driven builds (pin base images to digests,
deny/allow sources, enforce HTTP checksums) without modifying Dockerfiles.
The implementation:
- Adds --source-policy-file flag that passes through to buildctl
- Supports EXPERIMENTAL_BUILDKIT_SOURCE_POLICY env var for Docker Buildx compatibility
- Flag takes precedence over env var when both are set
This is a minimal passthrough to BuildKit - nerdctl does not validate the policy
file; BuildKit handles all validation and error messages.
See: https://github.com/moby/buildkit/blob/master/docs/build-repro.md
Signed-off-by: Konstantin Vyatkin <tino@vtkn.io>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/command-reference.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -780,6 +780,8 @@ Flags:
780
780
-:whale:`--network=(default|host|none)`: Set the networking mode for the RUN instructions during build.(compatible with `buildctl build`)
781
781
-:whale:`--build-context`: Set additional contexts for build (e.g. dir2=/path/to/dir2, myorg/myapp=docker-image://path/to/myorg/myapp)
782
782
-:whale:`--add-host`: Add a custom host-to-IP mapping (format: `host:ip`)
783
+
-:nerd_face:`--source-policy-file`: BuildKit source policy JSON file for reproducible builds. See [BuildKit build-repro docs](https://github.com/moby/buildkit/blob/master/docs/build-repro.md).
784
+
For compatibility with Docker Buildx, the `EXPERIMENTAL_BUILDKIT_SOURCE_POLICY` environment variable is also supported. Example no-op policy: `{"rules":[]}`
0 commit comments