Skip to content

Commit

Permalink
Add support for ALL_PROXY
Browse files Browse the repository at this point in the history
Support for ALL_PROXY as default build-arg was added recently in
buildkit and the classic builder.

This patch adds the `ALL_PROXY` environment variable to the list of
configurable proxy variables, and updates the documentation.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Jul 21, 2021
1 parent 72066d5 commit 7a0dc92
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cli/command/container/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ func TestCreateContainerWithProxyConfig(t *testing.T) {
"no_proxy=noProxy",
"FTP_PROXY=ftpProxy",
"ftp_proxy=ftpProxy",
"ALL_PROXY=allProxy",
"all_proxy=allProxy",
}
sort.Strings(expected)

Expand All @@ -299,6 +301,7 @@ func TestCreateContainerWithProxyConfig(t *testing.T) {
HTTPSProxy: "httpsProxy",
NoProxy: "noProxy",
FTPProxy: "ftpProxy",
AllProxy: "allProxy",
},
},
})
Expand Down
2 changes: 2 additions & 0 deletions cli/config/configfile/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type ProxyConfig struct {
HTTPSProxy string `json:"httpsProxy,omitempty"`
NoProxy string `json:"noProxy,omitempty"`
FTPProxy string `json:"ftpProxy,omitempty"`
AllProxy string `json:"allProxy,omitempty"`
}

// KubernetesConfig contains Kubernetes orchestrator settings
Expand Down Expand Up @@ -244,6 +245,7 @@ func (configFile *ConfigFile) ParseProxyConfig(host string, runOpts map[string]*
"HTTPS_PROXY": &config.HTTPSProxy,
"NO_PROXY": &config.NoProxy,
"FTP_PROXY": &config.FTPProxy,
"ALL_PROXY": &config.AllProxy,
}
m := runOpts
if m == nil {
Expand Down
4 changes: 4 additions & 0 deletions cli/config/configfile/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ func TestProxyConfig(t *testing.T) {
httpsProxy = "https://user:[email protected]:3129"
ftpProxy = "http://ftpproxy.mycorp.example.com:21"
noProxy = "*.intra.mycorp.example.com"
allProxy = "socks://example.com:1234"

defaultProxyConfig = ProxyConfig{
HTTPProxy: httpProxy,
HTTPSProxy: httpsProxy,
FTPProxy: ftpProxy,
NoProxy: noProxy,
AllProxy: allProxy,
}
)

Expand All @@ -57,6 +59,8 @@ func TestProxyConfig(t *testing.T) {
"ftp_proxy": &ftpProxy,
"NO_PROXY": &noProxy,
"no_proxy": &noProxy,
"ALL_PROXY": &allProxy,
"all_proxy": &allProxy,
}
assert.Check(t, is.DeepEqual(expected, proxyConfig))
}
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -1973,6 +1973,8 @@ corresponding `ARG` instruction in the Dockerfile.
- `ftp_proxy`
- `NO_PROXY`
- `no_proxy`
- `ALL_PROXY`
- `all_proxy`

To use these, pass them on the command line using the `--build-arg` flag, for
example:
Expand Down
4 changes: 3 additions & 1 deletion docs/reference/commandline/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ be set for each environment:
| `httpsProxy` | Default value of `HTTPS_PROXY` and `https_proxy` for containers, and as `--build-arg` on `docker build` |
| `ftpProxy` | Default value of `FTP_PROXY` and `ftp_proxy` for containers, and as `--build-arg` on `docker build` |
| `noProxy` | Default value of `NO_PROXY` and `no_proxy` for containers, and as `--build-arg` on `docker build` |
| `allProxy` | Default value of `ALL_PROXY` and `all_proxy` for containers, and as `--build-arg` on `docker build` |

These settings are used to configure proxy settings for containers only, and not
used as proxy settings for the `docker` CLI or the `dockerd` daemon. Refer to the
Expand Down Expand Up @@ -295,7 +296,8 @@ various fields:
"httpProxy": "http://user:[email protected]:3128",
"httpsProxy": "https://my-proxy.example.com:3129",
"noProxy": "intra.mycorp.example.com",
"ftpProxy": "http://user:[email protected]:3128"
"ftpProxy": "http://user:[email protected]:3128",
"allProxy": "socks://example.com:1234"
},
"https://manager1.mycorp.example.com:2377": {
"httpProxy": "http://user:[email protected]:3128",
Expand Down
2 changes: 2 additions & 0 deletions man/Dockerfile.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ A Dockerfile is similar to a Makefile.
* `ftp_proxy`
* `NO_PROXY`
* `no_proxy`
* `ALL_PROXY`
* `all_proxy`

To use these, pass them on the command line using `--build-arg` flag, for
example:
Expand Down

0 comments on commit 7a0dc92

Please sign in to comment.