Skip to content

docker-container: wait for BuildKit client readiness - #4027

Merged
crazy-max merged 2 commits into
docker:masterfrom
crazy-max:fix-docker-container-first-build-race
Sep 1, 2026
Merged

docker-container: wait for BuildKit client readiness#4027
crazy-max merged 2 commits into
docker:masterfrom
crazy-max:fix-docker-container-first-build-race

Conversation

@crazy-max

@crazy-max crazy-max commented Aug 20, 2026

Copy link
Copy Markdown
Member

fixes #4021
closes #4023

A freshly created docker-container builder can report as running before buildkitd is ready to serve its socket. Concurrent first builds can then fail with dial-stdio or server preface errors, and a cached failed client creation can make that transient startup failure sticky.

This change only caches successfully created driver clients and makes the docker-container driver wait for BuildKit readiness during the container startup window before returning a client. Established broken builders still fail promptly, while newly started builders get a bounded readiness wait through BuildKit's typed client API.

crazy-max and others added 2 commits September 1, 2026 09:16
Only memoize a BuildKit client after driver client creation succeeds. This lets
bootstrap retry after transient driver readiness errors instead of keeping the first
failed Client call for the lifetime of the handle.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Use the typed client wait during the container startup window. Avoid
delaying stopped or established broken builders.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@crazy-max
crazy-max force-pushed the fix-docker-container-first-build-race branch from 833613b to 2d4e67c Compare September 1, 2026 07:17
@crazy-max crazy-max changed the title docker-container: wait for BuildKit before dialing docker-container: wait for BuildKit client readiness Sep 1, 2026
@crazy-max
crazy-max requested a review from a team September 1, 2026 07:42
@crazy-max
crazy-max merged commit b0aec4f into docker:master Sep 1, 2026
162 checks passed
@crazy-max
crazy-max deleted the fix-docker-container-first-build-race branch September 1, 2026 11:04
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.

docker-container driver: builds connecting between container start and buildkitd readiness fail without retry (first-build bootstrap race)

3 participants