From 1e6ea0af8c90fd4de707094e5b077cd8d23f898b Mon Sep 17 00:00:00 2001 From: Ilya Guterman Date: Wed, 24 Jul 2019 11:20:55 +0300 Subject: [PATCH] driver/docker: use default network mode fallback to docker default network mode instead of explicit bridge for linux or nat for windows --- drivers/docker/driver.go | 4 ++-- drivers/docker/driver_default.go | 5 ----- drivers/docker/driver_windows.go | 5 ----- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/docker/driver.go b/drivers/docker/driver.go index b1df461e7..4242db4aa 100644 --- a/drivers/docker/driver.go +++ b/drivers/docker/driver.go @@ -882,8 +882,8 @@ func (d *Driver) createContainerConfig(task *drivers.TaskConfig, driverConfig *T hostConfig.NetworkMode = netMode } else { // docker default - logger.Debug("networking mode not specified; using default", "network_mode", defaultNetworkMode) - hostConfig.NetworkMode = defaultNetworkMode + logger.Debug("networking mode not specified; using default") + hostConfig.NetworkMode = "default" } } diff --git a/drivers/docker/driver_default.go b/drivers/docker/driver_default.go index 8cb644d16..7535d54a6 100644 --- a/drivers/docker/driver_default.go +++ b/drivers/docker/driver_default.go @@ -7,11 +7,6 @@ import ( "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 { return []docker.PortBinding{{HostIP: ip, HostPort: port}} } diff --git a/drivers/docker/driver_windows.go b/drivers/docker/driver_windows.go index 832171a6e..70c11bbaa 100644 --- a/drivers/docker/driver_windows.go +++ b/drivers/docker/driver_windows.go @@ -2,11 +2,6 @@ package docker 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. func getPortBinding(ip string, port string) []docker.PortBinding { return []docker.PortBinding{{HostIP: "", HostPort: port}}