From 00b0aae703f1d20cad54dd3da09bfd9b6fe024e8 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Fri, 21 Feb 2020 07:57:09 -0500 Subject: [PATCH] Add StopTimeout for podman Allow users to modify the default ammount of time to wait to send SIGKILL after you tell a container to stop with a SIGINT. Signed-off-by: Daniel J Walsh --- common/docs/containers.conf.5.md | 3 +++ common/pkg/config/config.go | 4 ++++ common/pkg/config/containers.conf | 3 +++ common/pkg/config/default.go | 1 + 4 files changed, 11 insertions(+) diff --git a/common/docs/containers.conf.5.md b/common/docs/containers.conf.5.md index b3d86bea01..c15f5860ea 100644 --- a/common/docs/containers.conf.5.md +++ b/common/docs/containers.conf.5.md @@ -315,6 +315,9 @@ refer to a member of the runtimes table. By default this will be configured relative to where containers/storage stores containers. +**stop_timeout**=10 + Number of seconds to wait for container to exit before sending kill signal. + **tmp_dir**="/var/run/libpod" The path to a temporary directory to store per-boot container. Must be a tmpfs (wiped after reboot). diff --git a/common/pkg/config/config.go b/common/pkg/config/config.go index b80e04dca8..4b536b3a5c 100644 --- a/common/pkg/config/config.go +++ b/common/pkg/config/config.go @@ -274,6 +274,10 @@ type LibpodConfig struct { // files. StaticDir string `toml:"static_dir"` + // StopTimeout is the number of seconds to wait for container to exit + // before sending kill signal. + StopTimeout uint `toml:"stop_timeout"` + // StorageConfig is the configuration used by containers/storage Not // included in the on-disk config, use the dedicated containers/storage // configuration file instead. diff --git a/common/pkg/config/containers.conf b/common/pkg/config/containers.conf index a0c9a32b18..91106b5767 100644 --- a/common/pkg/config/containers.conf +++ b/common/pkg/config/containers.conf @@ -365,6 +365,9 @@ # "/run/current-system/sw/bin/crun", # ] +# Number of seconds to wait for container to exit before sending kill signal. +#stop_timeout = 10 + # The [libpod.runtimes] table MUST be the last entry in this file. # (Unless another table is added) # TOML does not provide a way to end a table other than a further table being diff --git a/common/pkg/config/default.go b/common/pkg/config/default.go index 917de49665..6b83d7703f 100644 --- a/common/pkg/config/default.go +++ b/common/pkg/config/default.go @@ -213,6 +213,7 @@ func defaultConfigFromMemory() (*LibpodConfig, error) { c.OCIRuntime = "crun" } c.CgroupManager = SystemdCgroupsManager + c.StopTimeout = uint(10) c.OCIRuntimes = map[string][]string{ "runc": {