mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #40186 from pradipd/default-nat-subnet
Dockerd won't start if a network with the default subnet prefix already exists in HNS.
This commit is contained in:
commit
e25754b80c
1 changed files with 9 additions and 6 deletions
|
@ -35,7 +35,6 @@ import (
|
|||
|
||||
const (
|
||||
isWindows = true
|
||||
defaultNetworkSpace = "172.16.0.0/12"
|
||||
platformSupported = true
|
||||
windowsMinCPUShares = 1
|
||||
windowsMaxCPUShares = 10000
|
||||
|
@ -427,15 +426,19 @@ func initBridgeDriver(controller libnetwork.NetworkController, config *config.Co
|
|||
winlibnetwork.NetworkName: runconfig.DefaultDaemonNetworkMode().NetworkName(),
|
||||
}
|
||||
|
||||
subnetPrefix := defaultNetworkSpace
|
||||
var ipamOption libnetwork.NetworkOption
|
||||
var subnetPrefix string
|
||||
|
||||
if config.BridgeConfig.FixedCIDR != "" {
|
||||
subnetPrefix = config.BridgeConfig.FixedCIDR
|
||||
}
|
||||
|
||||
ipamV4Conf := libnetwork.IpamConf{PreferredPool: subnetPrefix}
|
||||
v4Conf := []*libnetwork.IpamConf{&ipamV4Conf}
|
||||
v6Conf := []*libnetwork.IpamConf{}
|
||||
ipamOption := libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil)
|
||||
if subnetPrefix != "" {
|
||||
ipamV4Conf := libnetwork.IpamConf{PreferredPool: subnetPrefix}
|
||||
v4Conf := []*libnetwork.IpamConf{&ipamV4Conf}
|
||||
v6Conf := []*libnetwork.IpamConf{}
|
||||
ipamOption = libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil)
|
||||
}
|
||||
|
||||
_, err := controller.NewNetwork(string(runconfig.DefaultDaemonNetworkMode()), runconfig.DefaultDaemonNetworkMode().NetworkName(), "",
|
||||
libnetwork.NetworkOptionGeneric(options.Generic{
|
||||
|
|
Loading…
Reference in a new issue