mirror of
https://github.com/moby/moby.git
synced 2025-07-29 07:21:35 +03:00
Add config parameter to change per-container stop timeout during daemon shutdown
This fix tries to add a flag `--stop-timeout` to specify the timeout value (in seconds) for the container to stop before SIGKILL is issued. If stop timeout is not specified then the default timeout (10s) is used. Additional test cases have been added to cover the change. This fix is related to #22471. Another pull request will add `--shutdown-timeout` to daemon for #22471. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
@ -496,3 +496,18 @@ exec "$@"`,
|
||||
out, _ = dockerCmd(c, "start", "-a", id)
|
||||
c.Assert(strings.TrimSpace(out), check.Equals, "foo")
|
||||
}
|
||||
|
||||
// #22471
|
||||
func (s *DockerSuite) TestCreateStopTimeout(c *check.C) {
|
||||
name1 := "test_create_stop_timeout_1"
|
||||
dockerCmd(c, "create", "--name", name1, "--stop-timeout", "15", "busybox")
|
||||
|
||||
res := inspectFieldJSON(c, name1, "Config.StopTimeout")
|
||||
c.Assert(res, checker.Contains, "15")
|
||||
|
||||
name2 := "test_create_stop_timeout_2"
|
||||
dockerCmd(c, "create", "--name", name2, "busybox")
|
||||
|
||||
res = inspectFieldJSON(c, name2, "Config.StopTimeout")
|
||||
c.Assert(res, checker.Contains, "null")
|
||||
}
|
||||
|
Reference in New Issue
Block a user