Skip to content

build: add always, missing and never pull policies - #4235

Draft
crazy-max wants to merge 2 commits into
docker:masterfrom
crazy-max:pull-policies
Draft

crazy-max wants to merge 2 commits into
docker:masterfrom
crazy-max:pull-policies

Conversation

@crazy-max

Copy link
Copy Markdown
Member

Add --pull=always|missing|never to build and Bake, including Bake target attributes and overrides. always forces registry resolution, missing prefers the worker's local image store, and never disables registry resolution and image fetching, failing when required content is unavailable locally. Existing boolean values remain supported, bare --pull still means always, and omitting the flag or passing --pull=false preserves the driver's existing behavior.

The never policy requires the BuildKit capability introduced in moby/buildkit#7457 and fails explicitly on unsupported builders. It also applies to image-backed named contexts and external Dockerfile frontends selected through #syntax or BUILDKIT_SYNTAX. Other policies retain the existing frontend-resolution behavior.

I'm keeping this PR in draft until we manage persistent tag-to-digest resolution for the Dockerfile frontend which I think is needed. Loading an external frontend currently caches its content without registering its tag in the worker's image store, so a successful online build does not guarantee that the same tagged frontend can be reused with --pull=never. A digest-pinned frontend can reuse locally cached content, but the usual tagged #syntax directive needs this additional work.

Signed-off-by: CrazyMax <[email protected]>
Allow build and bake to select an explicit image pull policy while
preserving existing boolean values and driver-dependent defaults.

Gate never on the builder capability so unsupported builders fail instead
of silently pulling images. Preserve boolean Bake serialization and
expressions while accepting policy strings and command-line overrides.

Signed-off-by: CrazyMax <[email protected]>

This branch has not been deployed

No deployments
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.

[proposal] implement pull-policies (docker build --pull=missing|never|always)

1 participant