mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Set EnableIPv4 for predefined networks
Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
@@ -626,6 +626,7 @@ func (c *containerConfig) networkCreateRequest(name string) (clustertypes.Networ
|
||||
return clustertypes.NetworkCreateRequest{}, errors.New("container: unknown network referenced")
|
||||
}
|
||||
|
||||
ipv4Enabled := true
|
||||
ipv6Enabled := na.Network.Spec.Ipv6Enabled
|
||||
options := network.CreateOptions{
|
||||
// ID: na.Network.ID,
|
||||
@@ -633,6 +634,7 @@ func (c *containerConfig) networkCreateRequest(name string) (clustertypes.Networ
|
||||
Internal: na.Network.Spec.Internal,
|
||||
Attachable: na.Network.Spec.Attachable,
|
||||
Ingress: convert.IsIngressNetwork(na.Network),
|
||||
EnableIPv4: &ipv4Enabled,
|
||||
EnableIPv6: &ipv6Enabled,
|
||||
Scope: scope.Swarm,
|
||||
}
|
||||
|
||||
@@ -1051,6 +1051,7 @@ func initBridgeDriver(controller *libnetwork.Controller, cfg config.BridgeConfig
|
||||
}
|
||||
// Initialize default network on "bridge" with the same name
|
||||
_, err = controller.NewNetwork("bridge", network.NetworkBridge, "",
|
||||
libnetwork.NetworkOptionEnableIPv4(true),
|
||||
libnetwork.NetworkOptionEnableIPv6(cfg.EnableIPv6),
|
||||
libnetwork.NetworkOptionDriverOpts(netOption),
|
||||
libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil),
|
||||
|
||||
@@ -386,6 +386,7 @@ func (daemon *Daemon) initNetworkController(daemonCfg *config.Config, activeSand
|
||||
_, err := daemon.netController.NewNetwork(strings.ToLower(v.Type), name, nid,
|
||||
libnetwork.NetworkOptionGeneric(options.Generic{
|
||||
netlabel.GenericData: netOption,
|
||||
netlabel.EnableIPv4: true,
|
||||
}),
|
||||
libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil),
|
||||
)
|
||||
@@ -430,6 +431,7 @@ func initBridgeDriver(controller *libnetwork.Controller, config config.BridgeCon
|
||||
_, err := controller.NewNetwork(network.DefaultNetwork, network.DefaultNetwork, "",
|
||||
libnetwork.NetworkOptionGeneric(options.Generic{
|
||||
netlabel.GenericData: netOption,
|
||||
netlabel.EnableIPv4: true,
|
||||
}),
|
||||
ipamOption,
|
||||
)
|
||||
|
||||
@@ -20,6 +20,7 @@ func (c *Controller) createGWNetwork() (*Network, error) {
|
||||
bridge.EnableICC: strconv.FormatBool(false),
|
||||
bridge.EnableIPMasquerade: strconv.FormatBool(true),
|
||||
}),
|
||||
NetworkOptionEnableIPv4(true),
|
||||
NetworkOptionEnableIPv6(false),
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user