Skip to content

resolver: allow anonymous auth while preserving local image fallback - #6760

Merged
tonistiigi merged 2 commits into
moby:masterfrom
crazy-max:session-empty-fallback
Jun 3, 2026
Merged

tonistiigi merged 2 commits into
moby:masterfrom
crazy-max:session-empty-fallback

Conversation

@crazy-max

@crazy-max crazy-max commented May 8, 2026 •

Copy link
Copy Markdown
Member

This PR restores anonymous Bearer token resolution from #6744 when no client session is active and preserves BuildKit's existing default-mode local fallback behavior.

The important clarification from the follow-up discussion is that BuildKit ResolveModeDefault is still remote-first. In v0.29, default mode only used the local image store opportunistically when remote Resolve() failed, and it returned the original remote error if local lookup also failed:

n, desc, err := r.Resolver.Resolve(ctx, ref)
if err == nil {
atomic.AddInt64(&r.handler.counter, 1)
return n, desc, nil
}
if r.mode == ResolveModeDefault && r.is != nil {
if img, err := getImageByRef(ctx, r.is, ref); err == nil {
return ref, img.Target, nil
}
}
return "", ocispecs.Descriptor{}, err

The regression from anonymous auth is that remote Resolve() can now succeed without a session, then fail later during image config or platform selection. This PR applies the same opportunistic local fallback at that later failure point, without changing pull mode or making BuildKit default mode prefer local.

This is separate from Moby's Docker build semantics. Moby currently maps PullParent=false to BuildKit image-resolve-mode=default and PullParent=true to pull: https://github.com/moby/moby/blob/675945d39e1b4dc0e5806b216191e29094e43ec1/daemon/internal/builder-next/builder.go#L350-L354. If Moby wants stronger legacy builder "local parent wins" behavior, that should be handled explicitly in Moby by choosing the appropriate resolve mode, not by changing BuildKit default mode here.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max
crazy-max force-pushed the session-empty-fallback branch 2 times, most recently from 644c28c to 13596a2 Compare May 29, 2026 14:47
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max
crazy-max force-pushed the session-empty-fallback branch from 13596a2 to ca9bcf0 Compare May 29, 2026 15:17
@tonistiigi
tonistiigi merged commit 174f4f0 into moby:master Jun 3, 2026
250 of 252 checks passed
@crazy-max
crazy-max deleted the session-empty-fallback branch June 3, 2026 15:41
zgeoff added a commit to zgeoff/impz that referenced this pull request Oct 3, 2026
Engines before Docker 29.6.0 (BuildKit v0.31.0, moby/buildkit#6760) fetch
the BUILDKIT_SYNTAX frontend only through a client session, which impd's
sessionless build lacks, so every build failed on Docker 28. impd now
inspects the frontend before the build and pulls it by digest when the
engine lacks it; a failed pull fails the build with a 502.
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.

2 participants