Browse code

Enabling specifying static ip for predefined network on windows

Signed-off-by: msabansal <sabansal@microsoft.com>

msabansal authored on 2016/04/21 07:35:11
Showing 3 changed files
... ...
@@ -511,7 +511,7 @@ func (daemon *Daemon) updateNetworkConfig(container *container.Container, idOrNa
511 511
 	}
512 512
 
513 513
 	if !containertypes.NetworkMode(idOrName).IsUserDefined() {
514
-		if hasUserDefinedIPAddress(endpointConfig) {
514
+		if hasUserDefinedIPAddress(endpointConfig) && !enableIPOnPredefinedNetwork() {
515 515
 			return nil, runconfig.ErrUnsupportedNetworkAndIP
516 516
 		}
517 517
 		if endpointConfig != nil && len(endpointConfig.Aliases) > 0 {
... ...
@@ -383,3 +383,7 @@ func isLinkable(child *container.Container) bool {
383 383
 func errRemovalContainer(containerID string) error {
384 384
 	return fmt.Errorf("Container %s is marked for removal and cannot be connected or disconnected to the network", containerID)
385 385
 }
386
+
387
+func enableIPOnPredefinedNetwork() bool {
388
+	return false
389
+}
... ...
@@ -55,3 +55,7 @@ func killProcessDirectly(container *container.Container) error {
55 55
 func isLinkable(child *container.Container) bool {
56 56
 	return false
57 57
 }
58
+
59
+func enableIPOnPredefinedNetwork() bool {
60
+	return true
61
+}