From 54bd0ae71671084c53bdd7e675e23c657d410280 Mon Sep 17 00:00:00 2001 From: TomSweeneyRedHat Date: Tue, 20 Mar 2018 13:13:09 -0400 Subject: Remove image via storage if a buildah container is associated Signed-off-by: TomSweeneyRedHat Closes: #522 Approved by: mheon --- cmd/podman/rmi.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cmd') diff --git a/cmd/podman/rmi.go b/cmd/podman/rmi.go index 244e07a06..c1be6dabb 100644 --- a/cmd/podman/rmi.go +++ b/cmd/podman/rmi.go @@ -4,6 +4,7 @@ import ( "fmt" "os" + "github.com/containers/storage" "github.com/pkg/errors" "github.com/projectatomic/libpod/libpod/image" "github.com/urfave/cli" @@ -76,6 +77,9 @@ func rmiCmd(c *cli.Context) error { for _, img := range imagesToDelete { msg, err := runtime.RemoveImage(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()) + } if lastError != nil { fmt.Fprintln(os.Stderr, lastError) } -- cgit v1.2.3-54-g00ecf