Skip to content

Commit 05002c2

Browse files
committed
Add support for forwarding Docker client through SOCKS proxy
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
1 parent 16effc6 commit 05002c2

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

daemon/info.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/docker/docker/utils"
2121
"github.com/docker/docker/volume/drivers"
2222
"github.com/docker/engine-api/types"
23+
"github.com/docker/go-connections/sockets"
2324
)
2425

2526
// SystemInfo returns information about the host server the daemon is running on.
@@ -97,9 +98,9 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
9798
ServerVersion: dockerversion.Version,
9899
ClusterStore: daemon.configStore.ClusterStore,
99100
ClusterAdvertise: daemon.configStore.ClusterAdvertise,
100-
HTTPProxy: getProxyEnv("http_proxy"),
101-
HTTPSProxy: getProxyEnv("https_proxy"),
102-
NoProxy: getProxyEnv("no_proxy"),
101+
HTTPProxy: sockets.GetProxyEnv("http_proxy"),
102+
HTTPSProxy: sockets.GetProxyEnv("https_proxy"),
103+
NoProxy: sockets.GetProxyEnv("no_proxy"),
103104
}
104105

105106
// TODO Windows. Refactor this more once sysinfo is refactored into

integration-cli/docker_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func (d *Daemon) getClientConfig() (*clientConfig, error) {
196196
transport = &http.Transport{}
197197
}
198198

199-
sockets.ConfigureTransport(transport, proto, addr)
199+
d.c.Assert(sockets.ConfigureTransport(transport, proto, addr), check.IsNil)
200200

201201
return &clientConfig{
202202
transport: transport,

pkg/plugins/client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ func NewClient(addr string, tlsConfig tlsconfig.Options) (*Client, error) {
3030
tr.TLSClientConfig = c
3131

3232
protoAndAddr := strings.Split(addr, "://")
33-
sockets.ConfigureTransport(tr, protoAndAddr[0], protoAndAddr[1])
33+
if err := sockets.ConfigureTransport(tr, protoAndAddr[0], protoAndAddr[1]); err != nil {
34+
return nil, err
35+
}
3436

3537
scheme := protoAndAddr[0]
3638
if scheme != "https" {

0 commit comments

Comments
 (0)