Merge pull request #1117 from hashicorp/f-docker-timeouts
Timeout docker connections after 1 minute
This commit is contained in:
commit
e1a9077654
|
@ -42,6 +42,10 @@ const (
|
||||||
// The key populated in Node Attributes to indicate presence of the Docker
|
// The key populated in Node Attributes to indicate presence of the Docker
|
||||||
// driver
|
// driver
|
||||||
dockerDriverAttr = "driver.docker"
|
dockerDriverAttr = "driver.docker"
|
||||||
|
|
||||||
|
// dockerTimeout is the length of time a request can be outstanding before
|
||||||
|
// it is timed out.
|
||||||
|
dockerTimeout = 1 * time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
type DockerDriver struct {
|
type DockerDriver struct {
|
||||||
|
@ -224,11 +228,13 @@ func (d *DockerDriver) dockerClient() (*docker.Client, error) {
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
client.HTTPClient.Timeout = dockerTimeout
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
d.logger.Println("[DEBUG] driver.docker: using client connection initialized from environment")
|
d.logger.Println("[DEBUG] driver.docker: using client connection initialized from environment")
|
||||||
client, err = docker.NewClientFromEnv()
|
client, err = docker.NewClientFromEnv()
|
||||||
|
client.HTTPClient.Timeout = dockerTimeout
|
||||||
})
|
})
|
||||||
return client, err
|
return client, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue