summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-27 16:47:32 -0400
committerGitHub <noreply@github.com>2021-04-27 16:47:32 -0400
commitf613a2a8d5778cf088f4d18b69c86b082264a882 (patch)
treebf07f589419a0d25d23125eaeb27f04103b49ca1 /libpod/options.go
parentdbc13f3dac4fa4095ae5db86085e5711a701eb7b (diff)
parent3538815c5b2b4c97304e3ea940cee414b0004d2f (diff)
downloadpodman-f613a2a8d5778cf088f4d18b69c86b082264a882.tar.gz
podman-f613a2a8d5778cf088f4d18b69c86b082264a882.tar.bz2
podman-f613a2a8d5778cf088f4d18b69c86b082264a882.zip
Merge pull request #10119 from rhatdan/timeout
Add podman run --timeout option
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 103a9a80a..39415a817 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -769,6 +769,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 {