Remove restrictions from docker networking mode; we assume users know what they are doing
This commit is contained in:
parent
f14d6685d7
commit
89c6f56059
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue