mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-23 08:09:37 -05:00
parent
8d4a71be3d
commit
42031f27fb
4 changed files with 13 additions and 2 deletions
|
|
@ -163,7 +163,11 @@ func resourceDockerContainer() *schema.Resource {
|
|||
Optional: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"working_dir": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
"capabilities": {
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,9 @@ func resourceDockerContainerCreate(d *schema.ResourceData, meta interface{}) err
|
|||
if len(exposedPorts) != 0 {
|
||||
config.ExposedPorts = exposedPorts
|
||||
}
|
||||
|
||||
if v, ok := d.GetOk("working_dir"); ok {
|
||||
config.WorkingDir = v.(string)
|
||||
}
|
||||
extraHosts := []string{}
|
||||
if v, ok := d.GetOk("host"); ok {
|
||||
extraHosts = extraHostsSetToDockerExtraHosts(v.(*schema.Set))
|
||||
|
|
|
|||
|
|
@ -451,6 +451,9 @@ func TestAccDockerContainer_customized(t *testing.T) {
|
|||
if c.HostConfig.UsernsMode != "testuser:231072:65536" {
|
||||
return fmt.Errorf("Container doesn't have a correct userns mode")
|
||||
}
|
||||
if c.Config.WorkingDir != "/tmp" {
|
||||
return fmt.Errorf("Container doesn't have a correct working dir")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -1432,6 +1435,7 @@ resource "docker_container" "foo" {
|
|||
|
||||
pid_mode = "host"
|
||||
userns_mode = "testuser:231072:65536"
|
||||
working_dir = "/tmp"
|
||||
}
|
||||
|
||||
resource "docker_network" "test_network" {
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ data is stored in them. See [the docker documentation][linkdoc] for more details
|
|||
one of "no", "on-failure", "always", "unless-stopped".
|
||||
* `max_retry_count` - (Optional, int) The maximum amount of times to an attempt
|
||||
a restart when `restart` is set to "on-failure"
|
||||
* `working_dir`- (Optional, string) The working directory for commands to run in
|
||||
* `rm` - (Optional, bool) If true, then the container will be automatically removed after his execution. Terraform
|
||||
won't check this container after creation.
|
||||
* `start` - (Optional, bool) If true, then the Docker container will be
|
||||
|
|
|
|||
Loading…
Reference in a new issue