diff --git a/client/driver/docker.go b/client/driver/docker.go index df02ff879..16bc56274 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -249,23 +249,13 @@ func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task, dri } } - mode := driverConfig.NetworkMode - if mode == "" { + hostConfig.NetworkMode := driverConfig.NetworkMode + if hostConfig.NetworkMode == "" { // docker default - d.logger.Printf("[WARN] driver.docker: no mode specified for networking, defaulting to bridge") - mode = "bridge" + d.logger.Printf("[INFO] driver.docker: networking mode not specified; defaulting to bridge") + hostConfig.NetworkMode = "bridge" } - // Ignore the container mode for now - switch mode { - case "default", "bridge", "none", "host": - d.logger.Printf("[DEBUG] driver.docker: using %s as network mode", mode) - default: - d.logger.Printf("[ERR] driver.docker: invalid setting for network mode: %s", mode) - return c, fmt.Errorf("Invalid setting for network mode: %s", mode) - } - hostConfig.NetworkMode = mode - // Setup port mapping and exposed ports if len(task.Resources.Networks) == 0 { d.logger.Print("[WARN] driver.docker: No network resources are available for port mapping")