diff --git a/container/container.go b/container/container.go index 30317a54c8..a8f267fb59 100644 --- a/container/container.go +++ b/container/container.go @@ -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) } diff --git a/container/container_unit_test.go b/container/container_unit_test.go index 7c4476c44a..67b36d81b4 100644 --- a/container/container_unit_test.go +++ b/container/container_unit_test.go @@ -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) } diff --git a/container/container_unix.go b/container/container_unix.go index 39ad978761..eef2ee8b3a 100644 --- a/container/container_unix.go +++ b/container/container_unix.go @@ -23,6 +23,9 @@ import ( ) const ( + // 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 diff --git a/container/container_windows.go b/container/container_windows.go index d34edc44a9..8229480df7 100644 --- a/container/container_windows.go +++ b/container/container_windows.go @@ -17,6 +17,9 @@ const ( containerInternalSecretMountPath = `C:\ProgramData\Docker\internal\secrets` containerInternalConfigsDirPath = `C:\ProgramData\Docker\internal\configs` + // 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 ) diff --git a/pkg/signal/signal_deprecated.go b/pkg/signal/signal_deprecated.go index 51b9ad062c..9977cad94b 100644 --- a/pkg/signal/signal_deprecated.go +++ b/pkg/signal/signal_deprecated.go @@ -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. )