diff --git a/container/container.go b/container/container.go index 10b9bcbe51..3e8a370241 100644 --- a/container/container.go +++ b/container/container.go @@ -52,11 +52,6 @@ import ( const configFileName = "config.v2.json" -const ( - // DefaultStopTimeout is the timeout (in seconds) for the syscall signal used to stop a container. - DefaultStopTimeout = 10 -) - var ( errInvalidEndpoint = errors.New("invalid endpoint while building port map info") errInvalidNetwork = errors.New("invalid network settings while building port map info") diff --git a/container/container_unix.go b/container/container_unix.go index 611bdfd9fb..98042f1308 100644 --- a/container/container_unix.go +++ b/container/container_unix.go @@ -21,6 +21,9 @@ import ( ) const ( + // DefaultStopTimeout is the timeout (in seconds) for the syscall signal used to stop a container. + DefaultStopTimeout = 10 + containerSecretMountPath = "/run/secrets" ) diff --git a/container/container_windows.go b/container/container_windows.go index 45d51e4f23..5cb2e456c9 100644 --- a/container/container_windows.go +++ b/container/container_windows.go @@ -16,6 +16,9 @@ const ( containerSecretMountPath = `C:\ProgramData\Docker\secrets` containerInternalSecretMountPath = `C:\ProgramData\Docker\internal\secrets` containerInternalConfigsDirPath = `C:\ProgramData\Docker\internal\configs` + + // DefaultStopTimeout is the timeout (in seconds) for the shutdown call on a container + DefaultStopTimeout = 30 ) // UnmountIpcMount unmounts Ipc related mounts. diff --git a/daemon/daemon.go b/daemon/daemon.go index 440cd91209..96b39e8820 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -993,7 +993,8 @@ func (daemon *Daemon) Shutdown() error { } if daemon.containers != nil { - logrus.Debugf("start clean shutdown of all containers with a %d seconds timeout...", daemon.configStore.ShutdownTimeout) + logrus.Debugf("daemon configured with a %d seconds minimum shutdown timeout", daemon.configStore.ShutdownTimeout) + logrus.Debugf("start clean shutdown of all containers with a %d seconds timeout...", daemon.ShutdownTimeout()) daemon.containers.ApplyAll(func(c *container.Container) { if !c.IsRunning() { return diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index 1737f34b4f..6865b9280a 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -2789,7 +2789,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownTimeout(c *check.C) { case <-time.After(5 * time.Second): } - expectedMessage := `level=debug msg="start clean shutdown of all containers with a 3 seconds timeout..."` + expectedMessage := `level=debug msg="daemon configured with a 3 seconds minimum shutdown timeout"` content, err := s.d.ReadLogFile() c.Assert(err, checker.IsNil) c.Assert(string(content), checker.Contains, expectedMessage)