Merge pull request #1335 from hashicorp/f-set-docker-timeout

Setting a timeout in the docker client
This commit is contained in:
Diptanu Choudhury 2016-06-21 17:00:14 -07:00 committed by GitHub
commit 0a10873aa6

View file

@ -264,11 +264,25 @@ func (d *DockerDriver) dockerClients() (*docker.Client, *docker.Client, error) {
if cert+key+ca != "" { if cert+key+ca != "" {
d.logger.Printf("[DEBUG] driver.docker: using TLS client connection to %s", dockerEndpoint) d.logger.Printf("[DEBUG] driver.docker: using TLS client connection to %s", dockerEndpoint)
client, err = docker.NewTLSClient(dockerEndpoint, cert, key, ca) client, err = docker.NewTLSClient(dockerEndpoint, cert, key, ca)
if err != nil {
merr.Errors = append(merr.Errors, err)
}
waitClient, err = docker.NewTLSClient(dockerEndpoint, cert, key, ca)
if err != nil {
merr.Errors = append(merr.Errors, err)
}
} else { } else {
d.logger.Printf("[DEBUG] driver.docker: using standard client connection to %s", dockerEndpoint) d.logger.Printf("[DEBUG] driver.docker: using standard client connection to %s", dockerEndpoint)
client, err = docker.NewClient(dockerEndpoint) client, err = docker.NewClient(dockerEndpoint)
if err != nil {
merr.Errors = append(merr.Errors, err)
}
waitClient, err = docker.NewClient(dockerEndpoint)
if err != nil {
merr.Errors = append(merr.Errors, err)
}
} }
client.HTTPClient.Timeout = dockerTimeout client.SetTimeout(dockerTimeout)
return return
} }
@ -277,7 +291,7 @@ func (d *DockerDriver) dockerClients() (*docker.Client, *docker.Client, error) {
if err != nil { if err != nil {
merr.Errors = append(merr.Errors, err) merr.Errors = append(merr.Errors, err)
} }
client.HTTPClient.Timeout = dockerTimeout client.SetTimeout(dockerTimeout)
waitClient, err = docker.NewClientFromEnv() waitClient, err = docker.NewClientFromEnv()
if err != nil { if err != nil {