Merge pull request #1564 from nickryand/docker_links
Added Docker links support to the docker_container resource.
This commit is contained in:
commit
2acc9b2e44
|
@ -108,6 +108,14 @@ func resourceDockerContainer() *schema.Resource {
|
|||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
Set: stringSetHash,
|
||||
},
|
||||
|
||||
"links": &schema.Schema{
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
Set: stringSetHash,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,6 +103,10 @@ func resourceDockerContainerCreate(d *schema.ResourceData, meta interface{}) err
|
|||
hostConfig.DNS = stringSetToStringSlice(v.(*schema.Set))
|
||||
}
|
||||
|
||||
if v, ok := d.GetOk("links"); ok {
|
||||
hostConfig.Links = stringSetToStringSlice(v.(*schema.Set))
|
||||
}
|
||||
|
||||
if err := client.StartContainer(retContainer.ID, hostConfig); err != nil {
|
||||
return fmt.Errorf("Unable to start container: %s", err)
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ The following arguments are supported:
|
|||
container.
|
||||
* `dns` - (Optional, set of strings) Set of DNS servers.
|
||||
* `env` - (Optional, set of strings) Environmental variables to set.
|
||||
* `links` - (Optional, set of strings) Set of links for link based
|
||||
connectivity between containers that are running on the same host.
|
||||
* `hostname` - (Optional, string) Hostname of the container.
|
||||
* `domainname` - (Optional, string) Domain name of the container.
|
||||
* `must_run` - (Optional, bool) If true, then the Docker container will be
|
||||
|
|
Loading…
Reference in New Issue