Implement kpod --rm code

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #81
Approved by: baude
This commit is contained in:
Daniel J Walsh
2017-11-27 21:05:11 +00:00
committed by Atomic Bot
parent 342ce4db50
commit ab62fe17ff
2 changed files with 7 additions and 0 deletions

View File

@ -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"),

View File

@ -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
}