Skip to content

build: ignore empty BUILDKIT_SYNTAX overrides#3734

Open
crazy-max wants to merge 1 commit intodocker:masterfrom
crazy-max:build-fix-empty-syntax
Open

build: ignore empty BUILDKIT_SYNTAX overrides#3734
crazy-max wants to merge 1 commit intodocker:masterfrom
crazy-max:build-fix-empty-syntax

Conversation

@crazy-max
Copy link
Member

@crazy-max crazy-max commented Mar 19, 2026

Do not switch to gateway.v0 when BUILDKIT_SYNTAX is present but empty. An empty value should not produce source="" and fail with invalid context name errors.

Before:

$ docker buildx build --build-arg BUILDKIT_SYNTAX="" https://github.com/docker/compose.git
#0 building with "default" instance using docker driver

#1 [internal] load git source https://github.com/docker/compose.git
#1 0.896 ref: refs/heads/main   HEAD
#1 0.896 b043368028e9fcb4545fa340c8ad635c370825da       HEAD
#1 1.496 b043368028e9fcb4545fa340c8ad635c370825da       refs/heads/main
#1 0.051 Initialized empty Git repository in /var/lib/desktop-containerd/daemon/io.containerd.snapshotter.v1.overlayfs/snapshots/24841/fs/
#1 0.498 ref: refs/heads/main   HEAD
#1 0.498 b043368028e9fcb4545fa340c8ad635c370825da       HEAD
#1 1.353 From https://github.com/docker/compose
#1 1.353  * [new branch]      main       -> main
#1 1.354  * [new branch]      main       -> origin/main
#1 1.358 b043368028e9fcb4545fa340c8ad635c370825da
#1 DONE 3.1s
ERROR: failed to build: failed to solve: invalid context name : invalid reference format

After:

$ docker buildx build --build-arg BUILDKIT_SYNTAX="" https://github.com/docker/compose.git
#0 building with "default" instance using docker driver

#1 [internal] load git source https://github.com/docker/compose.git
#1 0.597 ref: refs/heads/main   HEAD
#1 0.597 b043368028e9fcb4545fa340c8ad635c370825da       HEAD
#1 1.046 b043368028e9fcb4545fa340c8ad635c370825da       refs/heads/main
#1 CACHED
ERROR: failed to build: failed to solve: failed with build-arg:BUILDKIT_SYNTAX = : invalid context name : invalid reference format

This new error makes sense because BUILDKIT_SYNTAX="" still reaches BuildKit as build-arg:BUILDKIT_SYNTAX="" and treats it as an explicit syntax override, even when the value is empty. This should be fixed in BuildKit.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant