summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-04-22 15:38:36 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2021-04-23 11:18:05 -0400
commit3538815c5b2b4c97304e3ea940cee414b0004d2f (patch)
treea307b133a805e47633882d2f42e65105d903b247 /libpod/options.go
parentba60821f0aadef99f200fa708b26fb9921ed7b70 (diff)
downloadpodman-3538815c5b2b4c97304e3ea940cee414b0004d2f.tar.gz
podman-3538815c5b2b4c97304e3ea940cee414b0004d2f.tar.bz2
podman-3538815c5b2b4c97304e3ea940cee414b0004d2f.zip
Add podman run --timeout option
This option allows users to specify the maximum amount of time to run before conmon sends the kill signal to the container. Fixes: https://github.com/containers/podman/issues/6412 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 5cd0f7b88..c5c23ee16 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -758,6 +758,19 @@ func WithStopTimeout(timeout uint) CtrCreateOption {
}
}
+// WithTimeout sets the maximum time a container is allowed to run"
+func WithTimeout(timeout uint) CtrCreateOption {
+ return func(ctr *Container) error {
+ if ctr.valid {
+ return define.ErrCtrFinalized
+ }
+
+ ctr.config.Timeout = timeout
+
+ return nil
+ }
+}
+
// WithIDMappings sets the idmappings for the container
func WithIDMappings(idmappings storage.IDMappingOptions) CtrCreateOption {
return func(ctr *Container) error {