From c9f763456cd8263c3f2d84c6b2b6e17ad81cf3ba Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 31 May 2018 11:47:17 -0700 Subject: libpod: Execute poststop hooks locally Instead of delegating to the runtime, since some runtimes do not seem to handle these reliably [1]. [1]: https://github.com/projectatomic/libpod/issues/730#issuecomment-392959938 Signed-off-by: W. Trevor King Closes: #864 Approved by: rhatdan --- cmd/podman/rm.go | 3 ++- cmd/podman/rmi.go | 3 ++- cmd/podman/run.go | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go index d6af6db07..9fc65cb4d 100644 --- a/cmd/podman/rm.go +++ b/cmd/podman/rm.go @@ -37,6 +37,7 @@ var ( // saveCmd saves the image to either docker-archive or oci func rmCmd(c *cli.Context) error { + ctx := getContext() if err := validateFlags(c, rmFlags); err != nil { return err } @@ -81,7 +82,7 @@ func rmCmd(c *cli.Context) error { } } for _, container := range delContainers { - err = runtime.RemoveContainer(container, c.Bool("force")) + err = runtime.RemoveContainer(ctx, container, c.Bool("force")) if err != nil { if lastError != nil { fmt.Fprintln(os.Stderr, lastError) diff --git a/cmd/podman/rmi.go b/cmd/podman/rmi.go index dcf46a8e5..97c5b38cf 100644 --- a/cmd/podman/rmi.go +++ b/cmd/podman/rmi.go @@ -35,6 +35,7 @@ var ( ) func rmiCmd(c *cli.Context) error { + ctx := getContext() if err := validateFlags(c, rmiFlags); err != nil { return err } @@ -76,7 +77,7 @@ func rmiCmd(c *cli.Context) error { return errors.Errorf("no valid images to delete") } for _, img := range imagesToDelete { - msg, err := runtime.RemoveImage(img, c.Bool("force")) + msg, err := runtime.RemoveImage(ctx, img, c.Bool("force")) if err != nil { if errors.Cause(err) == storage.ErrImageUsedByContainer { fmt.Printf("A container associated with containers/storage, i.e. via Buildah, CRI-O, etc., may be associated with this image: %-12.12s\n", img.ID()) diff --git a/cmd/podman/run.go b/cmd/podman/run.go index f12a241fa..d6755df5e 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -225,7 +225,7 @@ func runCmd(c *cli.Context) error { } if createConfig.Rm { - return runtime.RemoveContainer(ctr, true) + return runtime.RemoveContainer(ctx, ctr, true) } if err := ctr.Cleanup(); err != nil { -- cgit v1.2.3-54-g00ecf