1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Increase container default shutdown timeout on Windows

The shutdown timeout for containers in insufficient on Windows. If the daemon is shutting down, and a container takes longer than expected to shut down, this can cause the container to remain in a bad state after restart, and never be able to start again. Increasing the timeout makes this less likely to occur.

Signed-off-by: Darren Stahl <darst@microsoft.com>
This commit is contained in:
Darren Stahl 2017-10-12 16:31:33 -07:00
parent 8ca8cc219d
commit ed74ee127f
5 changed files with 9 additions and 7 deletions

View file

@ -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")

View file

@ -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"
)

View file

@ -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.

View file

@ -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

View file

@ -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)