diff options
Diffstat (limited to 'cmd/podman/pods')
-rw-r--r-- | cmd/podman/pods/create.go | 6 | ||||
-rw-r--r-- | cmd/podman/pods/rm.go | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go index aea8a7229..4f1f66ad6 100644 --- a/cmd/podman/pods/create.go +++ b/cmd/podman/pods/create.go @@ -134,6 +134,12 @@ func create(cmd *cobra.Command, args []string) error { imageName = infraImage } img := imageName + + if !cmd.Flag("infra").Changed && (share == "none" || share == "") { + // we do not want an infra container when not sharing namespaces + createOptions.Infra = false + } + if !createOptions.Infra { if cmd.Flag("no-hosts").Changed { return fmt.Errorf("cannot specify --no-hosts without an infra container") diff --git a/cmd/podman/pods/rm.go b/cmd/podman/pods/rm.go index 2ffd968f9..0aa64481d 100644 --- a/cmd/podman/pods/rm.go +++ b/cmd/podman/pods/rm.go @@ -93,6 +93,9 @@ func removePods(namesOrIDs []string, rmOptions entities.PodRmOptions, printIDs b responses, err := registry.ContainerEngine().PodRm(context.Background(), namesOrIDs, rmOptions) if err != nil { + if rmOptions.Force && strings.Contains(err.Error(), define.ErrNoSuchPod.Error()) { + return nil + } setExitCode(err) return err } @@ -104,13 +107,15 @@ func removePods(namesOrIDs []string, rmOptions entities.PodRmOptions, printIDs b fmt.Println(r.Id) } } else { + if rmOptions.Force && strings.Contains(r.Err.Error(), define.ErrNoSuchPod.Error()) { + continue + } setExitCode(r.Err) errs = append(errs, r.Err) } } return errs.PrintErrors() } - func setExitCode(err error) { if errors.Is(err, define.ErrNoSuchPod) || strings.Contains(err.Error(), define.ErrNoSuchPod.Error()) { registry.SetExitCode(1) |