diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-10-29 14:29:48 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-10-29 14:29:48 -0400 |
commit | 5180ec985d1ed76174565437dc9c8001781bda28 (patch) | |
tree | ac4416aeff7f0f9a2352fb7f23005ecf670520f9 | |
parent | 222d8075ab08265c6dce8cf0f26a60c9afb64705 (diff) | |
download | podman-5180ec985d1ed76174565437dc9c8001781bda28.tar.gz podman-5180ec985d1ed76174565437dc9c8001781bda28.tar.bz2 podman-5180ec985d1ed76174565437dc9c8001781bda28.zip |
Fix the `--pull` flag to `podman build` to match Docker
The behavior should be as follows: Unset, pull if missing by
default, obey the `--pull-never` and `--pull-always` flags. Set
to false, pull never. Set to true, pull always.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
-rw-r--r-- | cmd/podman/images/build.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go index c53798589..0ff482cd9 100644 --- a/cmd/podman/images/build.go +++ b/cmd/podman/images/build.go @@ -241,8 +241,12 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil } pullPolicy := imagebuildah.PullIfNewer - if c.Flags().Changed("pull") && !flags.Pull { - pullPolicy = imagebuildah.PullIfMissing + if c.Flags().Changed("pull") { + if flags.Pull { + pullPolicy = imagebuildah.PullAlways + } else { + pullPolicy = imagebuildah.PullNever + } } if flags.PullAlways { pullPolicy = imagebuildah.PullAlways |