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

Merge pull request #42717 from thaJeztah/move_defaults

This commit is contained in:
Brian Goff 2021-08-24 09:33:22 -07:00 committed by GitHub
commit a44a8e54ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 12 deletions

View file

@ -518,7 +518,7 @@ func (container *Container) StopSignal() int {
}
if int(stopSignal) == 0 {
stopSignal, _ = signal.ParseSignal(signal.DefaultStopSignal)
stopSignal, _ = signal.ParseSignal(defaultStopSignal)
}
return int(stopSignal)
}
@ -528,7 +528,7 @@ func (container *Container) StopTimeout() int {
if container.Config.StopTimeout != nil {
return *container.Config.StopTimeout
}
return DefaultStopTimeout
return defaultStopTimeout
}
// InitDNSHostConfig ensures that the dns fields are never nil.

View file

@ -19,7 +19,7 @@ func TestContainerStopSignal(t *testing.T) {
Config: &container.Config{},
}
def, err := signal.ParseSignal(signal.DefaultStopSignal)
def, err := signal.ParseSignal(defaultStopSignal)
if err != nil {
t.Fatal(err)
}
@ -44,8 +44,8 @@ func TestContainerStopTimeout(t *testing.T) {
}
s := c.StopTimeout()
if s != DefaultStopTimeout {
t.Fatalf("Expected %v, got %v", DefaultStopTimeout, s)
if s != defaultStopTimeout {
t.Fatalf("Expected %v, got %v", defaultStopTimeout, s)
}
stopTimeout := 15

View file

@ -23,9 +23,12 @@ import (
)
const (
// DefaultStopTimeout sets the default time, in seconds, to wait
// defaultStopSignal is the default syscall signal used to stop a container.
defaultStopSignal = "SIGTERM"
// defaultStopTimeout sets the default time, in seconds, to wait
// for the graceful container stop before forcefully terminating it.
DefaultStopTimeout = 10
defaultStopTimeout = 10
containerConfigMountPath = "/"
containerSecretMountPath = "/run/secrets"

View file

@ -17,8 +17,11 @@ const (
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
// defaultStopSignal is the default syscall signal used to stop a container.
defaultStopSignal = "SIGTERM"
// defaultStopTimeout is the timeout (in seconds) for the shutdown call on a container
defaultStopTimeout = 30
)
// UnmountIpcMount unmounts Ipc related mounts.

View file

@ -48,7 +48,8 @@ const (
// SIGPIPE is a signal sent to a process when a pipe is written to before the other end is open for reading
// Deprecated: use github.com/moby/sys/signal.SIGPIPE instead
SIGPIPE = msignal.SIGPIPE
// DefaultStopSignal is the syscall signal used to stop a container in unix systems.
// Deprecated: use github.com/moby/sys/signal.DefaultStopSignal instead
DefaultStopSignal = msignal.DefaultStopSignal
// DefaultStopSignal has been deprecated and removed. The default value is
// now defined in github.com/docker/docker/container. Clients should omit
// the container's stop-signal field if the default should be used.
)