docker / docker/buildx

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

Open
#1,889 11 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/cli kind/enhancement status/needs-maintainer-decision
Dominant language
Go
Stars
4.5k
Forks
682
Avg merge
2d 14h
Merged PRs (30d)
29

Description

Pull request https://github.com/docker/cli/pull/1498 added a --pull option to docker run and docker create (to address https://github.com/moby/moby/issues/34394), which allows the pull-policy to be configured to use, and has three options:

--pull description
(not set) (default) pull the image if it does not exist locally
--pull=missing same as default above
--pull=never don't pull the image, but produce an error if the image does not exist
--pull=always always attempt to pull the image, even if the image exists locally:
produce an error if pull failed

docker build also has a --pull flag, but is implemented as a boolean:

--pull description
(not set) (default) pull the image if it does not exist locally
--pull=false same as above
--pull / --pull=true always attempt to pull the image, even if the image exists locally:
produce an error if pull failed. This is the equivalent of
--pull=always on docker run
Proposal

I think it would make sense to have docker build support the same options as docker run. For backward-compatibility, --pull would be the equivalent of --pull=always:

--pull description
(not set) (default) pull the image if it does not exist locally
--pull=missing same as default above
--pull=never don't pull the image, but produce an error if the image does not exist
--pull=always always attempt to pull the image, even if the image exists locally:
produce an error if pull failed
--pull equivalent to --pull=always. kept for backward compatibility

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing docker build --pull option and compare its behavior with the pull-policy handling already used by docker run and docker create. Implement the missing, never, and always values while preserving the existing --pull compatibility behavior; done means each documented policy produces the specified pull or error behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.