Browse code

Merge pull request #14691 from Microsoft/10662-start

Windows: hostconfig on start

Antonio Murdaca authored on 2015/07/21 07:52:19
Showing 1 changed files
... ...
@@ -2,6 +2,7 @@ package daemon
2 2
 
3 3
 import (
4 4
 	"fmt"
5
+	"runtime"
5 6
 
6 7
 	"github.com/docker/docker/runconfig"
7 8
 )
... ...
@@ -24,11 +25,18 @@ func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConf
24 24
 		return err
25 25
 	}
26 26
 
27
-	// This is kept for backward compatibility - hostconfig should be passed when
28
-	// creating a container, not during start.
29
-	if hostConfig != nil {
30
-		if err := daemon.setHostConfig(container, hostConfig); err != nil {
31
-			return err
27
+	// Windows does not have the backwards compatibilty issue here.
28
+	if runtime.GOOS != "windows" {
29
+		// This is kept for backward compatibility - hostconfig should be passed when
30
+		// creating a container, not during start.
31
+		if hostConfig != nil {
32
+			if err := daemon.setHostConfig(container, hostConfig); err != nil {
33
+				return err
34
+			}
35
+		}
36
+	} else {
37
+		if hostConfig != nil {
38
+			return fmt.Errorf("Supplying a hostconfig on start is not supported. It should be supplied on create")
32 39
 		}
33 40
 	}
34 41