From 5180ec985d1ed76174565437dc9c8001781bda28 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Thu, 29 Oct 2020 14:29:48 -0400 Subject: 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 --- cmd/podman/images/build.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cmd/podman') 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 -- cgit v1.2.3-54-g00ecf