summaryrefslogtreecommitdiff
path: root/cmd/podman/stop.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/stop.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/stop.go')
-rw-r--r--cmd/podman/stop.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go
index e04d8a12b..acecb298e 100644
--- a/cmd/podman/stop.go
+++ b/cmd/podman/stop.go
@@ -25,7 +25,7 @@ var (
return stopCmd(&stopCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, true)
},
Example: `podman stop ctrID
podman stop --latest
@@ -42,7 +42,9 @@ func init() {
flags.BoolVarP(&stopCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
flags.UintVar(&stopCommand.Timeout, "time", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
flags.UintVarP(&stopCommand.Timeout, "timeout", "t", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
+ flags.StringArrayVarP(&stopCommand.CIDFiles, "cidfile", "", nil, "Read the container ID from the file")
markFlagHiddenForRemoteClient("latest", flags)
+ markFlagHiddenForRemoteClient("cidfile", flags)
}
// stopCmd stops a container or containers