aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/rm.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-06-13 16:51:31 -0400
committerMatthew Heon <matthew.heon@pm.me>2019-06-13 17:02:20 -0400
commit49e696642d4d2d08bb89d6968f50ef9d6f17361a (patch)
tree6f90e20212f2cc9c5d3d31ea64c91702ba5c2144 /cmd/podman/rm.go
parent2784cf3ca3c635b1383823dd9bc47d26274e60e3 (diff)
downloadpodman-49e696642d4d2d08bb89d6968f50ef9d6f17361a.tar.gz
podman-49e696642d4d2d08bb89d6968f50ef9d6f17361a.tar.bz2
podman-49e696642d4d2d08bb89d6968f50ef9d6f17361a.zip
Add --storage flag to 'podman rm' (local only)
This flag switches to removing containers directly from c/storage and is mostly used to remove orphan containers. It's a superior solution to our former one, which attempted removal from storage under certain circumstances and could, under some conditions, not trigger. Also contains the beginning of support for storage in `ps` but wiring that in is going to be a much bigger pain. Fixes #3329. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'cmd/podman/rm.go')
-rw-r--r--cmd/podman/rm.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go
index 1bf56b782..2710a8194 100644
--- a/cmd/podman/rm.go
+++ b/cmd/podman/rm.go
@@ -42,7 +42,9 @@ func init() {
flags.BoolVarP(&rmCommand.All, "all", "a", false, "Remove all containers")
flags.BoolVarP(&rmCommand.Force, "force", "f", false, "Force removal of a running container. The default is false")
flags.BoolVarP(&rmCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
+ flags.BoolVar(&rmCommand.Storage, "storage", false, "Remove container from storage library")
flags.BoolVarP(&rmCommand.Volumes, "volumes", "v", false, "Remove the volumes associated with the container")
+ markFlagHiddenForRemoteClient("storage", flags)
markFlagHiddenForRemoteClient("latest", flags)
}
@@ -54,6 +56,13 @@ func rmCmd(c *cliconfig.RmValues) error {
}
defer runtime.Shutdown(false)
+ // Storage conflicts with --all/--latest/--volumes
+ if c.Storage {
+ if c.All || c.Latest || c.Volumes {
+ return errors.Errorf("--storage conflicts with --volumes, --all, and --latest")
+ }
+ }
+
ok, failures, err := runtime.RemoveContainers(getContext(), c)
if err != nil {
if errors.Cause(err) == libpod.ErrNoSuchCtr {