Add privileged option to docker container resource

This commit is contained in:
Julian Schneider 2015-06-04 12:57:38 +02:00
parent 1b4b73c2e1
commit b9a437658e
3 changed files with 8 additions and 0 deletions

View File

@ -136,6 +136,12 @@ func resourceDockerContainer() *schema.Resource {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"privileged": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},
}, },
} }
} }

View File

@ -85,6 +85,7 @@ func resourceDockerContainerCreate(d *schema.ResourceData, meta interface{}) err
d.SetId(retContainer.ID) d.SetId(retContainer.ID)
hostConfig := &dc.HostConfig{ hostConfig := &dc.HostConfig{
Privileged: d.Get("privileged").(bool),
PublishAllPorts: d.Get("publish_all_ports").(bool), PublishAllPorts: d.Get("publish_all_ports").(bool),
} }

View File

@ -46,6 +46,7 @@ The following arguments are supported:
kept running. If false, then as long as the container exists, Terraform kept running. If false, then as long as the container exists, Terraform
assumes it is successful. assumes it is successful.
* `ports` - (Optional) See [Ports](#ports) below for details. * `ports` - (Optional) See [Ports](#ports) below for details.
* `privileged` - (Optional, bool) Run container in privileged mode.
* `publish_all_ports` - (Optional, bool) Publish all ports of the container. * `publish_all_ports` - (Optional, bool) Publish all ports of the container.
* `volumes` - (Optional) See [Volumes](#volumes) below for details. * `volumes` - (Optional) See [Volumes](#volumes) below for details.