Enabling specifying static ip for predefined network on windows

Signed-off-by: msabansal <sabansal@microsoft.com>
Upstream-commit: 1991f6ebd6a5e496d291d96f8bb2aca3f2e9cd0b
Component: engine
This commit is contained in:
msabansal
2016-04-20 15:35:11 -07:00
parent c93d8a8a0f
commit e31fdfde0e
3 changed files with 9 additions and 1 deletions

View File

@ -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 {

View File

@ -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
}

View File

@ -55,3 +55,7 @@ func killProcessDirectly(container *container.Container) error {
func isLinkable(child *container.Container) bool {
return false
}
func enableIPOnPredefinedNetwork() bool {
return true
}