From a571b3622ea0c780439c05c0bdc932270f7f26e4 Mon Sep 17 00:00:00 2001 From: Michael Dwan Date: Fri, 18 Apr 2025 09:22:30 -0600 Subject: [PATCH] Disable provenance attestations Docker desktop w/ containerd enabled is creating provenance attestations with each build. When this happens, each image is pushed with 2 additional manifests, one is the provenance manifest containing build facts, and the other an index pointing to the actual image and the provenance manifest. While useful in some contexts, cog is not one of them atm. The registry is ignoring them, but this PR disables creation entirely. --- pkg/docker/build.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/docker/build.go b/pkg/docker/build.go index 227c5cd52d..93e4ce7921 100644 --- a/pkg/docker/build.go +++ b/pkg/docker/build.go @@ -14,9 +14,11 @@ import ( ) func Build(dir, dockerfileContents, imageName string, secrets []string, noCache bool, progressOutput string, epoch int64, contextDir string, buildContexts map[string]string) error { - var args []string - - args = append(args, "buildx", "build") + args := []string{ + "buildx", "build", + // disable provenance attestations since we don't want them cluttering the registry + "--provenance", "false", + } if util.IsAppleSiliconMac(runtime.GOOS, runtime.GOARCH) { // Fixes "WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested" @@ -74,11 +76,11 @@ func Build(dir, dockerfileContents, imageName string, secrets []string, noCache } func BuildAddLabelsAndSchemaToImage(image string, labels map[string]string, bundledSchemaFile string, bundledSchemaPy string) error { - var args []string - - args = append(args, + args := []string{ "buildx", "build", - ) + // disable provenance attestations since we don't want them cluttering the registry + "--provenance", "false", + } if util.IsAppleSiliconMac(runtime.GOOS, runtime.GOARCH) { // Fixes "WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested"