driver/docker: use default network mode

fallback to docker default network mode instead of explicit bridge for linux
or nat for windows
This commit is contained in:
Ilya Guterman 2019-07-24 11:20:55 +03:00
parent 34deb47a8b
commit 1e6ea0af8c
3 changed files with 2 additions and 12 deletions

View file

@ -882,8 +882,8 @@ func (d *Driver) createContainerConfig(task *drivers.TaskConfig, driverConfig *T
hostConfig.NetworkMode = netMode hostConfig.NetworkMode = netMode
} else { } else {
// docker default // docker default
logger.Debug("networking mode not specified; using default", "network_mode", defaultNetworkMode) logger.Debug("networking mode not specified; using default")
hostConfig.NetworkMode = defaultNetworkMode hostConfig.NetworkMode = "default"
} }
} }

View file

@ -7,11 +7,6 @@ import (
"github.com/moby/moby/daemon/caps" "github.com/moby/moby/daemon/caps"
) )
const (
// Setting default network mode for non-windows OS as bridge
defaultNetworkMode = "bridge"
)
func getPortBinding(ip string, port string) []docker.PortBinding { func getPortBinding(ip string, port string) []docker.PortBinding {
return []docker.PortBinding{{HostIP: ip, HostPort: port}} return []docker.PortBinding{{HostIP: ip, HostPort: port}}
} }

View file

@ -2,11 +2,6 @@ package docker
import docker "github.com/fsouza/go-dockerclient" import docker "github.com/fsouza/go-dockerclient"
const (
// Default network mode for windows containers is nat
defaultNetworkMode = "nat"
)
//Currently Windows containers don't support host ip in port binding. //Currently Windows containers don't support host ip in port binding.
func getPortBinding(ip string, port string) []docker.PortBinding { func getPortBinding(ip string, port string) []docker.PortBinding {
return []docker.PortBinding{{HostIP: "", HostPort: port}} return []docker.PortBinding{{HostIP: "", HostPort: port}}