Browse Source

Merge pull request #28563 from darrenstahlmsft/ShutdownOnStop

Shutdown instead of terminate process on Windows
Vincent Demeester 8 năm trước cách đây
mục cha
commit
c8bf933697
1 tập tin đã thay đổi với 7 bổ sung5 xóa
  1. 7 5
      libcontainerd/client_windows.go

+ 7 - 5
libcontainerd/client_windows.go

@@ -15,7 +15,7 @@ import (
 	"github.com/Microsoft/hcsshim"
 	"github.com/Microsoft/hcsshim"
 	"github.com/Sirupsen/logrus"
 	"github.com/Sirupsen/logrus"
 	"github.com/docker/docker/pkg/sysinfo"
 	"github.com/docker/docker/pkg/sysinfo"
-	"github.com/opencontainers/runtime-spec/specs-go"
+	specs "github.com/opencontainers/runtime-spec/specs-go"
 )
 )
 
 
 type client struct {
 type client struct {
@@ -396,10 +396,12 @@ func (clnt *client) Signal(containerID string, sig int) error {
 			}
 			}
 		}
 		}
 	} else {
 	} else {
-		// Terminate Process
-		if err := cont.hcsProcess.Kill(); err != nil && !hcsshim.IsAlreadyStopped(err) {
-			// ignore errors
-			logrus.Warnf("libcontainerd: failed to terminate pid %d in %s: %q", cont.systemPid, containerID, err)
+		// Shut down the container
+		if err := cont.hcsContainer.Shutdown(); err != nil {
+			if !hcsshim.IsPending(err) && !hcsshim.IsAlreadyStopped(err) {
+				// ignore errors
+				logrus.Warnf("libcontainerd: failed to shutdown container %s: %q", containerID, err)
+			}
 		}
 		}
 	}
 	}