diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/images/build.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go index f24e9a8f6..7db927e55 100644 --- a/cmd/podman/images/build.go +++ b/cmd/podman/images/build.go @@ -304,6 +304,21 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil return nil, err } + pullFlagsCount := 0 + if c.Flag("pull").Changed { + pullFlagsCount++ + } + if c.Flag("pull-always").Changed { + pullFlagsCount++ + } + if c.Flag("pull-never").Changed { + pullFlagsCount++ + } + + if pullFlagsCount > 1 { + return nil, errors.Errorf("can only set one of 'pull' or 'pull-always' or 'pull-never'") + } + pullPolicy := define.PullIfMissing if c.Flags().Changed("pull") && flags.Pull { pullPolicy = define.PullAlways @@ -313,7 +328,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil } if flags.PullNever { - pullPolicy = define.PullIfMissing + pullPolicy = define.PullNever } args := make(map[string]string) |