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 <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-04-30 11:53:53 +02:00
Родитель 72066d5099
Коммит 7a0dc924f9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 76698F39D527CE8C
6 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -277,6 +277,8 @@ func TestCreateContainerWithProxyConfig(t *testing.T) {
"no_proxy=noProxy", "no_proxy=noProxy",
"FTP_PROXY=ftpProxy", "FTP_PROXY=ftpProxy",
"ftp_proxy=ftpProxy", "ftp_proxy=ftpProxy",
"ALL_PROXY=allProxy",
"all_proxy=allProxy",
} }
sort.Strings(expected) sort.Strings(expected)
@ -299,6 +301,7 @@ func TestCreateContainerWithProxyConfig(t *testing.T) {
HTTPSProxy: "httpsProxy", HTTPSProxy: "httpsProxy",
NoProxy: "noProxy", NoProxy: "noProxy",
FTPProxy: "ftpProxy", FTPProxy: "ftpProxy",
AllProxy: "allProxy",
}, },
}, },
}) })

Просмотреть файл

@ -60,6 +60,7 @@ type ProxyConfig struct {
HTTPSProxy string `json:"httpsProxy,omitempty"` HTTPSProxy string `json:"httpsProxy,omitempty"`
NoProxy string `json:"noProxy,omitempty"` NoProxy string `json:"noProxy,omitempty"`
FTPProxy string `json:"ftpProxy,omitempty"` FTPProxy string `json:"ftpProxy,omitempty"`
AllProxy string `json:"allProxy,omitempty"`
} }
// KubernetesConfig contains Kubernetes orchestrator settings // KubernetesConfig contains Kubernetes orchestrator settings
@ -244,6 +245,7 @@ func (configFile *ConfigFile) ParseProxyConfig(host string, runOpts map[string]*
"HTTPS_PROXY": &config.HTTPSProxy, "HTTPS_PROXY": &config.HTTPSProxy,
"NO_PROXY": &config.NoProxy, "NO_PROXY": &config.NoProxy,
"FTP_PROXY": &config.FTPProxy, "FTP_PROXY": &config.FTPProxy,
"ALL_PROXY": &config.AllProxy,
} }
m := runOpts m := runOpts
if m == nil { if m == nil {

Просмотреть файл

@ -32,12 +32,14 @@ func TestProxyConfig(t *testing.T) {
httpsProxy = "https://user:password@proxy.mycorp.example.com:3129" httpsProxy = "https://user:password@proxy.mycorp.example.com:3129"
ftpProxy = "http://ftpproxy.mycorp.example.com:21" ftpProxy = "http://ftpproxy.mycorp.example.com:21"
noProxy = "*.intra.mycorp.example.com" noProxy = "*.intra.mycorp.example.com"
allProxy = "socks://example.com:1234"
defaultProxyConfig = ProxyConfig{ defaultProxyConfig = ProxyConfig{
HTTPProxy: httpProxy, HTTPProxy: httpProxy,
HTTPSProxy: httpsProxy, HTTPSProxy: httpsProxy,
FTPProxy: ftpProxy, FTPProxy: ftpProxy,
NoProxy: noProxy, NoProxy: noProxy,
AllProxy: allProxy,
} }
) )
@ -57,6 +59,8 @@ func TestProxyConfig(t *testing.T) {
"ftp_proxy": &ftpProxy, "ftp_proxy": &ftpProxy,
"NO_PROXY": &noProxy, "NO_PROXY": &noProxy,
"no_proxy": &noProxy, "no_proxy": &noProxy,
"ALL_PROXY": &allProxy,
"all_proxy": &allProxy,
} }
assert.Check(t, is.DeepEqual(expected, proxyConfig)) assert.Check(t, is.DeepEqual(expected, proxyConfig))
} }

Просмотреть файл

@ -1973,6 +1973,8 @@ corresponding `ARG` instruction in the Dockerfile.
- `ftp_proxy` - `ftp_proxy`
- `NO_PROXY` - `NO_PROXY`
- `no_proxy` - `no_proxy`
- `ALL_PROXY`
- `all_proxy`
To use these, pass them on the command line using the `--build-arg` flag, for To use these, pass them on the command line using the `--build-arg` flag, for
example: example:

Просмотреть файл

@ -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` | | `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` | | `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` | | `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 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 used as proxy settings for the `docker` CLI or the `dockerd` daemon. Refer to the
@ -295,7 +296,8 @@ various fields:
"httpProxy": "http://user:pass@example.com:3128", "httpProxy": "http://user:pass@example.com:3128",
"httpsProxy": "https://my-proxy.example.com:3129", "httpsProxy": "https://my-proxy.example.com:3129",
"noProxy": "intra.mycorp.example.com", "noProxy": "intra.mycorp.example.com",
"ftpProxy": "http://user:pass@example.com:3128" "ftpProxy": "http://user:pass@example.com:3128",
"allProxy": "socks://example.com:1234"
}, },
"https://manager1.mycorp.example.com:2377": { "https://manager1.mycorp.example.com:2377": {
"httpProxy": "http://user:pass@example.com:3128", "httpProxy": "http://user:pass@example.com:3128",

Просмотреть файл

@ -437,6 +437,8 @@ A Dockerfile is similar to a Makefile.
* `ftp_proxy` * `ftp_proxy`
* `NO_PROXY` * `NO_PROXY`
* `no_proxy` * `no_proxy`
* `ALL_PROXY`
* `all_proxy`
To use these, pass them on the command line using `--build-arg` flag, for To use these, pass them on the command line using `--build-arg` flag, for
example: example: