From f385e33181c9e8e44391dc570b2fc0fb4da69d71 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Tue, 21 Jun 2016 16:25:10 -0700 Subject: [PATCH] Setting a timeout in the docker client --- client/driver/docker.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/client/driver/docker.go b/client/driver/docker.go index c0ef89ca6a9..bbc0db9028e 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -254,11 +254,25 @@ func (d *DockerDriver) dockerClients() (*docker.Client, *docker.Client, error) { if cert+key+ca != "" { d.logger.Printf("[DEBUG] driver.docker: using TLS client connection to %s", dockerEndpoint) 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 { d.logger.Printf("[DEBUG] driver.docker: using standard client connection to %s", 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 } @@ -267,7 +281,7 @@ func (d *DockerDriver) dockerClients() (*docker.Client, *docker.Client, error) { if err != nil { merr.Errors = append(merr.Errors, err) } - client.HTTPClient.Timeout = dockerTimeout + client.SetTimeout(dockerTimeout) waitClient, err = docker.NewClientFromEnv() if err != nil {