diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go index a3b9e3e143bf..d5b4bbcc435a 100644 --- a/cmd/podman/containers/create.go +++ b/cmd/podman/containers/create.go @@ -154,6 +154,13 @@ func create(cmd *cobra.Command, args []string) error { } imageName = name } + + if cliVals.Authfile != "" { + if _, err := os.Stat(cliVals.Authfile); err != nil { + return err + } + } + s := specgen.NewSpecGenerator(imageName, cliVals.RootFS) if err := specgenutil.FillOutSpecGen(s, &cliVals, args); err != nil { return err diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 2b089f25731e..18cbc4fbdb3c 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -1158,4 +1158,12 @@ EOF run_podman rm -f -t0 $ctr } +@test "podman run --authfile=/tmp/bogus " { + run_podman 125 run --authfile=/tmp/bogus $IMAGE false + is "$output" "Error: stat /tmp/bogus: no such file or directory" "should faile with not such file" + + run_podman 125 create --authfile=/tmp/bogus $IMAGE false + is "$output" "Error: stat /tmp/bogus: no such file or directory" "should faile with not such file" +} + # vim: filetype=sh