Browse Source

Windows: hostconfig on start

Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard 10 năm trước cách đây
mục cha
commit
39ad38ccf9
1 tập tin đã thay đổi với 13 bổ sung5 xóa
  1. 13 5
      daemon/start.go

+ 13 - 5
daemon/start.go

@@ -2,6 +2,7 @@ package daemon
 
 import (
 	"fmt"
+	"runtime"
 
 	"github.com/docker/docker/runconfig"
 )
@@ -24,11 +25,18 @@ func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConf
 		return err
 	}
 
-	// This is kept for backward compatibility - hostconfig should be passed when
-	// creating a container, not during start.
-	if hostConfig != nil {
-		if err := daemon.setHostConfig(container, hostConfig); err != nil {
-			return err
+	// Windows does not have the backwards compatibilty issue here.
+	if runtime.GOOS != "windows" {
+		// This is kept for backward compatibility - hostconfig should be passed when
+		// creating a container, not during start.
+		if hostConfig != nil {
+			if err := daemon.setHostConfig(container, hostConfig); err != nil {
+				return err
+			}
+		}
+	} else {
+		if hostConfig != nil {
+			return fmt.Errorf("Supplying a hostconfig on start is not supported. It should be supplied on create")
 		}
 	}