Add support for forwarding Docker client through SOCKS proxy

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov 2016-02-16 10:05:05 -08:00
parent 16effc66c0
commit 05002c2501
3 changed files with 8 additions and 5 deletions

View file

@ -20,6 +20,7 @@ import (
"github.com/docker/docker/utils"
"github.com/docker/docker/volume/drivers"
"github.com/docker/engine-api/types"
"github.com/docker/go-connections/sockets"
)
// SystemInfo returns information about the host server the daemon is running on.
@ -97,9 +98,9 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
ServerVersion: dockerversion.Version,
ClusterStore: daemon.configStore.ClusterStore,
ClusterAdvertise: daemon.configStore.ClusterAdvertise,
HTTPProxy: getProxyEnv("http_proxy"),
HTTPSProxy: getProxyEnv("https_proxy"),
NoProxy: getProxyEnv("no_proxy"),
HTTPProxy: sockets.GetProxyEnv("http_proxy"),
HTTPSProxy: sockets.GetProxyEnv("https_proxy"),
NoProxy: sockets.GetProxyEnv("no_proxy"),
}
// TODO Windows. Refactor this more once sysinfo is refactored into

View file

@ -196,7 +196,7 @@ func (d *Daemon) getClientConfig() (*clientConfig, error) {
transport = &http.Transport{}
}
sockets.ConfigureTransport(transport, proto, addr)
d.c.Assert(sockets.ConfigureTransport(transport, proto, addr), check.IsNil)
return &clientConfig{
transport: transport,

View file

@ -30,7 +30,9 @@ func NewClient(addr string, tlsConfig tlsconfig.Options) (*Client, error) {
tr.TLSClientConfig = c
protoAndAddr := strings.Split(addr, "://")
sockets.ConfigureTransport(tr, protoAndAddr[0], protoAndAddr[1])
if err := sockets.ConfigureTransport(tr, protoAndAddr[0], protoAndAddr[1]); err != nil {
return nil, err
}
scheme := protoAndAddr[0]
if scheme != "https" {