From e31fdfde0ed3276fe47bba71567bcd163ac22a04 Mon Sep 17 00:00:00 2001 From: msabansal Date: Wed, 20 Apr 2016 15:35:11 -0700 Subject: [PATCH] Enabling specifying static ip for predefined network on windows Signed-off-by: msabansal Upstream-commit: 1991f6ebd6a5e496d291d96f8bb2aca3f2e9cd0b Component: engine --- components/engine/daemon/container_operations.go | 2 +- components/engine/daemon/container_operations_unix.go | 4 ++++ components/engine/daemon/container_operations_windows.go | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/components/engine/daemon/container_operations.go b/components/engine/daemon/container_operations.go index 3bd50fa31f..1bc828dcda 100644 --- a/components/engine/daemon/container_operations.go +++ b/components/engine/daemon/container_operations.go @@ -511,7 +511,7 @@ func (daemon *Daemon) updateNetworkConfig(container *container.Container, idOrNa } if !containertypes.NetworkMode(idOrName).IsUserDefined() { - if hasUserDefinedIPAddress(endpointConfig) { + if hasUserDefinedIPAddress(endpointConfig) && !enableIPOnPredefinedNetwork() { return nil, runconfig.ErrUnsupportedNetworkAndIP } if endpointConfig != nil && len(endpointConfig.Aliases) > 0 { diff --git a/components/engine/daemon/container_operations_unix.go b/components/engine/daemon/container_operations_unix.go index 55bd3fc839..d2b849445e 100644 --- a/components/engine/daemon/container_operations_unix.go +++ b/components/engine/daemon/container_operations_unix.go @@ -383,3 +383,7 @@ func isLinkable(child *container.Container) bool { func errRemovalContainer(containerID string) error { return fmt.Errorf("Container %s is marked for removal and cannot be connected or disconnected to the network", containerID) } + +func enableIPOnPredefinedNetwork() bool { + return false +} diff --git a/components/engine/daemon/container_operations_windows.go b/components/engine/daemon/container_operations_windows.go index 32d18c2fa3..16f0c81509 100644 --- a/components/engine/daemon/container_operations_windows.go +++ b/components/engine/daemon/container_operations_windows.go @@ -55,3 +55,7 @@ func killProcessDirectly(container *container.Container) error { func isLinkable(child *container.Container) bool { return false } + +func enableIPOnPredefinedNetwork() bool { + return true +}