aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2017-11-27 21:05:11 +0000
committerAtomic Bot <atomic-devel@projectatomic.io>2017-11-28 15:01:20 +0000
commitab62fe17ff7910a4727e07f6d075b425185a5860 (patch)
tree833e400459259dd20545418a2c90a4fe0b3ee715
parent342ce4db50ed89605bbdd5f8ac30c3db08e15a7e (diff)
downloadpodman-ab62fe17ff7910a4727e07f6d075b425185a5860.tar.gz
podman-ab62fe17ff7910a4727e07f6d075b425185a5860.tar.bz2
podman-ab62fe17ff7910a4727e07f6d075b425185a5860.zip
Implement kpod --rm code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #81 Approved by: baude
-rw-r--r--cmd/kpod/create.go4
-rw-r--r--cmd/kpod/run.go3
2 files changed, 7 insertions, 0 deletions
diff --git a/cmd/kpod/create.go b/cmd/kpod/create.go
index 2812874fa..c310ab831 100644
--- a/cmd/kpod/create.go
+++ b/cmd/kpod/create.go
@@ -355,6 +355,10 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, er
return nil, errors.Errorf("--pid %q is not valid", c.String("pid"))
}
+ if c.Bool("detach") && c.Bool("rm") {
+ return nil, errors.Errorf("--rm and --detach can not be specified together")
+ }
+
config := &createConfig{
runtime: runtime,
capAdd: c.StringSlice("cap-add"),
diff --git a/cmd/kpod/run.go b/cmd/kpod/run.go
index b79ba5121..ec68d8b97 100644
--- a/cmd/kpod/run.go
+++ b/cmd/kpod/run.go
@@ -136,5 +136,8 @@ func runCmd(c *cli.Context) error {
fmt.Printf("%s\n", ctr.ID())
}
wg.Wait()
+ if createConfig.rm {
+ return runtime.RemoveContainer(ctr, true)
+ }
return nil
}