summaryrefslogtreecommitdiff
path: root/cmd/podman/rm.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2019-11-15 14:05:46 -0500
committerValentin Rothberg <rothberg@redhat.com>2019-11-18 14:44:08 +0100
commit061bf77588c573668646fb07ded748c9bf375130 (patch)
treeab5a0374830213f887ce5aae4816d7bca567d2d9 /cmd/podman/rm.go
parentd7ed9fa188b502e155ddbf6b626cf8fbfc92bbb8 (diff)
downloadpodman-061bf77588c573668646fb07ded748c9bf375130.tar.gz
podman-061bf77588c573668646fb07ded748c9bf375130.tar.bz2
podman-061bf77588c573668646fb07ded748c9bf375130.zip
podman rm/stop --cidfile
Add a --cidfile flag to podman rm/stop to pass a container ID via a file. Podman run already provides the functionaly to store the ID in a specified file which we now complete with rm/stop. This allows for a better life-cycle management in systemd services. Note that --cdifile can be specified multiple times to rm/stop. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd/podman/rm.go')
-rw-r--r--cmd/podman/rm.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go
index 6329a9d8e..b3bc8e1b9 100644
--- a/cmd/podman/rm.go
+++ b/cmd/podman/rm.go
@@ -25,7 +25,7 @@ var (
return rmCmd(&rmCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, true)
},
Example: `podman rm imageID
podman rm mywebserver myflaskserver 860a4b23
@@ -44,8 +44,10 @@ func init() {
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 anonymous volumes associated with the container")
+ flags.StringArrayVarP(&rmCommand.CIDFiles, "cidfile", "", nil, "Read the container ID from the file")
markFlagHiddenForRemoteClient("storage", flags)
markFlagHiddenForRemoteClient("latest", flags)
+ markFlagHiddenForRemoteClient("cidfile", flags)
}
// rmCmd removes one or more containers
@@ -58,8 +60,8 @@ func rmCmd(c *cliconfig.RmValues) error {
// 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")
+ if c.All || c.Latest || c.Volumes || c.CIDFiles != nil {
+ return errors.Errorf("--storage conflicts with --volumes, --all, --latest and --cidfile")
}
}