From 59defcb34d5be358ebaacaadd21ed7e6307a493e Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Mon, 13 May 2019 13:31:00 +0100 Subject: [PATCH] add a 10s timeout to the client object. This partially mitigates #1739 ("Docker commands take 1 minute to timeout if context endpoint is unreachable") and is a simpler alternative to #1747 (which completely defers the client connection until an actual call is attempted). Note that the previous 60s delay was the culmination of two separate 30s timeouts since the ping is tried twice. This with this patch the overall timeout is 20s. https://github.com/moby/moby/pull/39206 will remove the second ping and once that propagates to this tree the timeout will be 10s. Signed-off-by: Ian Campbell --- cli/context/docker/load.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/context/docker/load.go b/cli/context/docker/load.go index 126fa2f2e8..b163dac38a 100644 --- a/cli/context/docker/load.go +++ b/cli/context/docker/load.go @@ -122,6 +122,7 @@ func (c *Endpoint) ClientOpts() ([]client.Opt, error) { client.WithDialContext(helper.Dialer), ) } + result = append(result, client.WithTimeout(10*time.Second)) } version := os.Getenv("DOCKER_API_VERSION")