Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cmd/podman/common/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ func DefineBuildFlags(cmd *cobra.Command, buildOpts *BuildFlagsWrapper) {

// --pull flag
flag := budFlags.Lookup("pull")
if err := flag.Value.Set("true"); err != nil {
logrus.Errorf("Unable to set --pull to true: %v", err)
flag.DefValue = "missing"
if err := flag.Value.Set("missing"); err != nil {
Copy link
Member

@TomSweeneyRedHat TomSweeneyRedHat Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm mistaken, this is different than Docker, which does a pull=true by default.

logrus.Errorf("Unable to set --pull to 'missing': %v", err)
}
flag.DefValue = "true"
flag.Usage = "Always attempt to pull the image (errors are fatal)"
flag.Usage = `Pull image policy ("always/true"|"missing"|"never/false"|"newer")`
flags.AddFlagSet(&budFlags)

// Add the completion functions
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-build.1.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ the help of emulation provided by packages like `qemu-user-static`.

#### **--pull**=*policy*

Pull image policy. The default is **always**.
Pull image policy. The default is **missing**.

- **always**, **true**: Always pull the image and throw an error if the pull fails.
- **missing**: Only pull the image when it does not exist in the local containers storage. Throw an error if no image is found and the pull fails.
Expand Down
4 changes: 4 additions & 0 deletions test/system/070-build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ EOF
PODMAN_TIMEOUT=240 run_podman build -t build_test --format=docker $tmpdir
is "$output" ".*COMMIT" "COMMIT seen in log"

# $IMAGE is preloaded, so we should never re-pull
assert "$output" !~ "Trying to pull" "Default pull policy should be 'missing'"
assert "$output" !~ "Writing manifest" "Default pull policy should be 'missing'"

run_podman run --rm build_test cat /$rand_filename
is "$output" "$rand_content" "reading generated file in image"

Expand Down