diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-04-27 16:47:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-27 16:47:32 -0400 |
commit | f613a2a8d5778cf088f4d18b69c86b082264a882 (patch) | |
tree | bf07f589419a0d25d23125eaeb27f04103b49ca1 /pkg/specgen | |
parent | dbc13f3dac4fa4095ae5db86085e5711a701eb7b (diff) | |
parent | 3538815c5b2b4c97304e3ea940cee414b0004d2f (diff) | |
download | podman-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 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/container_create.go | 3 | ||||
-rw-r--r-- | pkg/specgen/specgen.go | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index 2f623bf10..277435ef1 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -325,6 +325,9 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen. if s.StopTimeout != nil { options = append(options, libpod.WithStopTimeout(*s.StopTimeout)) } + if s.Timeout != 0 { + options = append(options, libpod.WithTimeout(s.Timeout)) + } if s.LogConfiguration != nil { if len(s.LogConfiguration.Path) > 0 { options = append(options, libpod.WithLogPath(s.LogConfiguration.Path)) diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index e3d4b1436..fdcb7a0e0 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -83,6 +83,11 @@ type ContainerBasicConfig struct { // instead. // Optional. StopTimeout *uint `json:"stop_timeout,omitempty"` + // Timeout is a maximum time in seconds the container will run before + // main process is sent SIGKILL. + // If 0 is used, signal will not be sent. Container can run indefinitely + // Optional. + Timeout uint `json:"timeout,omitempty"` // LogConfiguration describes the logging for a container including // driver, path, and options. // Optional |