diff --git a/daemon/cluster/executor/container/container.go b/daemon/cluster/executor/container/container.go index 736c06f1f8075..4e698d2d22060 100644 --- a/daemon/cluster/executor/container/container.go +++ b/daemon/cluster/executor/container/container.go @@ -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, } diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go index 475eaee9d7ff1..fc53019d86b90 100644 --- a/daemon/daemon_unix.go +++ b/daemon/daemon_unix.go @@ -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), diff --git a/daemon/daemon_windows.go b/daemon/daemon_windows.go index 9f2c793df90b9..81894cca7368e 100644 --- a/daemon/daemon_windows.go +++ b/daemon/daemon_windows.go @@ -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, ) diff --git a/libnetwork/default_gateway_linux.go b/libnetwork/default_gateway_linux.go index bbed4e4d0ec03..d4cef393d6866 100644 --- a/libnetwork/default_gateway_linux.go +++ b/libnetwork/default_gateway_linux.go @@ -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 {