diff --git a/container/container.go b/container/container.go index 9edbcbb0a7..5ca14523fd 100644 --- a/container/container.go +++ b/container/container.go @@ -511,16 +511,16 @@ func (container *Container) IsDestinationMounted(destination string) bool { } // StopSignal returns the signal used to stop the container. -func (container *Container) StopSignal() int { +func (container *Container) StopSignal() syscall.Signal { var stopSignal syscall.Signal if container.Config.StopSignal != "" { stopSignal, _ = signal.ParseSignal(container.Config.StopSignal) } - if int(stopSignal) == 0 { + if stopSignal == 0 { stopSignal, _ = signal.ParseSignal(defaultStopSignal) } - return int(stopSignal) + return stopSignal } // StopTimeout returns the timeout (in seconds) used to stop the container. diff --git a/container/container_unit_test.go b/container/container_unit_test.go index 030583039d..3e4c6e4fa5 100644 --- a/container/container_unit_test.go +++ b/container/container_unit_test.go @@ -24,7 +24,7 @@ func TestContainerStopSignal(t *testing.T) { } s := c.StopSignal() - if s != int(def) { + if s != def { t.Fatalf("Expected %v, got %v", def, s) } diff --git a/daemon/stop.go b/daemon/stop.go index 517b7953af..5a659c1cc8 100644 --- a/daemon/stop.go +++ b/daemon/stop.go @@ -2,7 +2,6 @@ package daemon // import "github.com/docker/docker/daemon" import ( "context" - "syscall" "time" containertypes "github.com/docker/docker/api/types/container" @@ -43,7 +42,7 @@ func (daemon *Daemon) containerStop(ctx context.Context, ctr *container.Containe } var ( - stopSignal = syscall.Signal(ctr.StopSignal()) + stopSignal = ctr.StopSignal() stopTimeout = ctr.StopTimeout() ) if options.Signal != "" {