mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
don't cancel container stop when cancelling context
Commit90de570cfapassed through the request context to daemon.ContainerStop(). As a result, cancelling the context would cancel the "graceful" stop of the container, and would proceed with forcefully killing the container. This patch partially reverts the changes from90de570cfaand breaks the context to prevent cancelling the context from cancelling the stop. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -36,7 +36,13 @@ func (daemon *Daemon) ContainerStop(ctx context.Context, name string, options co
|
||||
}
|
||||
|
||||
// containerStop sends a stop signal, waits, sends a kill signal.
|
||||
func (daemon *Daemon) containerStop(ctx context.Context, ctr *container.Container, options containertypes.StopOptions) (retErr error) {
|
||||
func (daemon *Daemon) containerStop(_ context.Context, ctr *container.Container, options containertypes.StopOptions) (retErr error) {
|
||||
// Deliberately using a local context here, because cancelling the
|
||||
// request should not cancel the stop.
|
||||
//
|
||||
// TODO(thaJeztah): pass context, and use context.WithoutCancel() once available: https://github.com/golang/go/issues/40221
|
||||
ctx := context.Background()
|
||||
|
||||
if !ctr.IsRunning() {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user