Skip to content

Commit

Permalink
Merge pull request #1117 from hashicorp/f-docker-timeouts
Browse files Browse the repository at this point in the history
Timeout docker connections after 1 minute
  • Loading branch information
dadgar committed Apr 22, 2016
2 parents 482b9c4 + 98aa9e6 commit 27b40bf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/driver/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ const (
// The key populated in Node Attributes to indicate presence of the Docker
// driver
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 {
Expand Down Expand Up @@ -224,11 +228,13 @@ func (d *DockerDriver) dockerClient() (*docker.Client, error) {
d.logger.Printf("[DEBUG] driver.docker: using standard client connection to %s", dockerEndpoint)
client, err = docker.NewClient(dockerEndpoint)
}
client.HTTPClient.Timeout = dockerTimeout
return
}

d.logger.Println("[DEBUG] driver.docker: using client connection initialized from environment")
client, err = docker.NewClientFromEnv()
client.HTTPClient.Timeout = dockerTimeout
})
return client, err
}
Expand Down

0 comments on commit 27b40bf

Please sign in to comment.