Merge pull request #4475 from ColinHebert/docker_network_mode
provider/docker: Add network_mode support to docker
This commit is contained in:
commit
0955983655
|
@ -238,6 +238,12 @@ func resourceDockerContainer() *schema.Resource {
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"network_mode": &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
ForceNew: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,6 +136,10 @@ func resourceDockerContainerCreate(d *schema.ResourceData, meta interface{}) err
|
||||||
hostConfig.LogConfig.Config = mapTypeMapValsToString(v.(map[string]interface{}))
|
hostConfig.LogConfig.Config = mapTypeMapValsToString(v.(map[string]interface{}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v, ok := d.GetOk("network_mode"); ok {
|
||||||
|
hostConfig.NetworkMode = v.(string)
|
||||||
|
}
|
||||||
|
|
||||||
createOpts.HostConfig = hostConfig
|
createOpts.HostConfig = hostConfig
|
||||||
|
|
||||||
var retContainer *dc.Container
|
var retContainer *dc.Container
|
||||||
|
|
|
@ -155,5 +155,6 @@ resource "docker_container" "foo" {
|
||||||
max-size = "10m"
|
max-size = "10m"
|
||||||
max-file = 20
|
max-file = 20
|
||||||
}
|
}
|
||||||
|
network_mode = "bridge"
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
|
@ -68,6 +68,7 @@ The following arguments are supported:
|
||||||
Defaults to "json-file".
|
Defaults to "json-file".
|
||||||
* `log_opts` - (Optional) Key/value pairs to use as options for the logging
|
* `log_opts` - (Optional) Key/value pairs to use as options for the logging
|
||||||
driver.
|
driver.
|
||||||
|
* `network_mode` - (Optional) Network mode of the container.
|
||||||
|
|
||||||
<a id="ports"></a>
|
<a id="ports"></a>
|
||||||
## Ports
|
## Ports
|
||||||
|
|
Loading…
Reference in New Issue