浏览代码

Merge pull request #2010 from madhanrm/hotaddfix

Fix to use ContainerID for windows instead of SanbdoxID
Flavio Crisciani 7 年之前
父节点
当前提交
08f9dfeaf8
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      libnetwork/controller.go

+ 7 - 1
libnetwork/controller.go

@@ -48,6 +48,7 @@ import (
 	"fmt"
 	"net"
 	"path/filepath"
+	"runtime"
 	"strings"
 	"sync"
 	"time"
@@ -1074,10 +1075,15 @@ func (c *controller) NewSandbox(containerID string, options ...SandboxOption) (S
 	}
 	c.Unlock()
 
+	sandboxID := stringid.GenerateRandomID()
+	if runtime.GOOS == "windows" {
+		sandboxID = containerID
+	}
+
 	// Create sandbox and process options first. Key generation depends on an option
 	if sb == nil {
 		sb = &sandbox{
-			id:                 stringid.GenerateRandomID(),
+			id:                 sandboxID,
 			containerID:        containerID,
 			endpoints:          epHeap{},
 			epPriority:         map[string]int{},