mirror of https://github.com/docker/cli.git
Merge pull request #415 from jlhawn/client_dial_enable_tcp_keepalive
Enable TCP Keep-Alive in Docker client
This commit is contained in:
commit
f7b78dc137
|
@ -2,9 +2,11 @@ package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/docker/cli/cli"
|
"github.com/docker/cli/cli"
|
||||||
cliconfig "github.com/docker/cli/cli/config"
|
cliconfig "github.com/docker/cli/cli/config"
|
||||||
|
@ -214,6 +216,10 @@ func newHTTPClient(host string, tlsOptions *tlsconfig.Options) (*http.Client, er
|
||||||
}
|
}
|
||||||
tr := &http.Transport{
|
tr := &http.Transport{
|
||||||
TLSClientConfig: config,
|
TLSClientConfig: config,
|
||||||
|
DialContext: (&net.Dialer{
|
||||||
|
KeepAlive: 30 * time.Second,
|
||||||
|
Timeout: 30 * time.Second,
|
||||||
|
}).DialContext,
|
||||||
}
|
}
|
||||||
proto, addr, _, err := client.ParseHost(host)
|
proto, addr, _, err := client.ParseHost(host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue