summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2018-11-28 12:24:14 -0500
committerMatthew Heon <mheon@redhat.com>2018-12-06 09:10:45 -0500
commita0c9be20617a871c6cb61f27516565af36338d7a (patch)
treeef09e2cd5bda4a87fc6c8b3ac735cdf6615065b0 /cmd/podman
parent75b19ca8abe1957f3c48035767960a6b20c10519 (diff)
downloadpodman-a0c9be20617a871c6cb61f27516565af36338d7a.tar.gz
podman-a0c9be20617a871c6cb61f27516565af36338d7a.tar.bz2
podman-a0c9be20617a871c6cb61f27516565af36338d7a.zip
Add --sync option to podman rm
With the changes made recently to ensure Podman does not hit the OCI runtime as often to sync state, we can find ourselves in a situation where the runtime's state does not match ours. Add a --sync flag to podman rm to ensure we can still remove containers when this happens. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/rm.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go
index 7c0569b78..224df4543 100644
--- a/cmd/podman/rm.go
+++ b/cmd/podman/rm.go
@@ -21,6 +21,10 @@ var (
},
LatestFlag,
cli.BoolFlag{
+ Name: "sync",
+ Usage: "Sync container state with OCI runtime before removing",
+ },
+ cli.BoolFlag{
Name: "volumes, v",
Usage: "Remove the volumes associated with the container (Not implemented yet)",
},
@@ -73,6 +77,12 @@ func rmCmd(c *cli.Context) error {
for _, container := range delContainers {
con := container
f := func() error {
+ if c.Bool("sync") {
+ if err := con.Sync(); err != nil {
+ return err
+ }
+ }
+
return runtime.RemoveContainer(ctx, con, c.Bool("force"))
}