summaryrefslogtreecommitdiff
path: root/cmd/podman/pods/rm.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/pods/rm.go')
-rw-r--r--cmd/podman/pods/rm.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/cmd/podman/pods/rm.go b/cmd/podman/pods/rm.go
index dc4c7eb83..d8a09d774 100644
--- a/cmd/podman/pods/rm.go
+++ b/cmd/podman/pods/rm.go
@@ -42,6 +42,7 @@ var (
podman pod rm -f 860a4b23
podman pod rm -f -a`,
}
+ stopTimeout uint
)
func init() {
@@ -59,6 +60,10 @@ func init() {
flags.StringArrayVarP(&rmOptions.PodIDFiles, podIDFileFlagName, "", nil, "Read the pod ID from the file")
_ = rmCommand.RegisterFlagCompletionFunc(podIDFileFlagName, completion.AutocompleteDefault)
+ timeFlagName := "time"
+ flags.UintVarP(&stopTimeout, timeFlagName, "t", containerConfig.Engine.StopTimeout, "Seconds to wait for pod stop before killing the container")
+ _ = rmCommand.RegisterFlagCompletionFunc(timeFlagName, completion.AutocompleteNone)
+
validate.AddLatestFlag(rmCommand, &rmOptions.Latest)
if registry.IsRemote() {
@@ -66,12 +71,18 @@ func init() {
}
}
-func rm(_ *cobra.Command, args []string) error {
+func rm(cmd *cobra.Command, args []string) error {
ids, err := specgenutil.ReadPodIDFiles(rmOptions.PodIDFiles)
if err != nil {
return err
}
args = append(args, ids...)
+ if cmd.Flag("time").Changed {
+ if !rmOptions.Force {
+ return errors.New("--force option must be specified to use the --time option")
+ }
+ rmOptions.Timeout = &stopTimeout
+ }
return removePods(args, rmOptions.PodRmOptions, true)
}