Skip to content

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

@thaJeztah

Description

@thaJeztah

Pull request docker/cli#1498 added a --pull option to docker run and docker create (to address moby/moby#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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions