aboutsummaryrefslogtreecommitdiff
path: root/integration
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2022-04-02 16:03:39 +0200
committerSebastiaan van Stijn <github@gone.nl>2022-04-07 19:43:02 +0200
commit101dafd049949a4da65dcefd495828a6644e1ce1 (patch)
tree4213eea7f55101b06f1bcbb1da3c3b7bf7ab00f7 /integration
parenta461373146d11606cecb5e9ec142a71182fc9813 (diff)
daemon/config: move proxy settings to "proxies" struct within daemon.json
This is a follow-up to 427c7cc5f86364466c7173e8ca59b97c3876471d, which added proxy-configuration options ("http-proxy", "https-proxy", "no-proxy") to the dockerd cli and in `daemon.json`. While working on documentation changes for this feature, I realised that those options won't be "next" to each-other when formatting the daemon.json JSON, for example using `jq` (which sorts the fields alphabetically). As it's possible that additional proxy configuration options are added in future, I considered that grouping these options in a struct within the JSON may help setting these options, as well as discovering related options. This patch introduces a "proxies" field in the JSON, which includes the "http-proxy", "https-proxy", "no-proxy" options. Conflict detection continues to work as before; with this patch applied: mkdir -p /etc/docker/ echo '{"proxies":{"http-proxy":"http-config", "https-proxy":"https-config", "no-proxy": "no-proxy-config"}}' > /etc/docker/daemon.json dockerd --http-proxy=http-flag --https-proxy=https-flag --no-proxy=no-proxy-flag --validate unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: http-proxy: (from flag: http-flag, from file: http-config), https-proxy: (from flag: https-flag, from file: https-config), no-proxy: (from flag: no-proxy-flag, from file: no-proxy-config) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'integration')
-rw-r--r--integration/daemon/daemon_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/integration/daemon/daemon_test.go b/integration/daemon/daemon_test.go
index 0c4f80f959..346857d9ae 100644
--- a/integration/daemon/daemon_test.go
+++ b/integration/daemon/daemon_test.go
@@ -253,7 +253,7 @@ func TestDaemonProxy(t *testing.T) {
ctx := context.Background()
configFile := filepath.Join(d.RootDir(), "daemon.json")
- configJSON := fmt.Sprintf(`{"http-proxy":%[1]q, "https-proxy": %[1]q, "no-proxy": "example.com"}`, proxyServer.URL)
+ configJSON := fmt.Sprintf(`{"proxies":{"http-proxy":%[1]q, "https-proxy": %[1]q, "no-proxy": "example.com"}}`, proxyServer.URL)
assert.NilError(t, os.WriteFile(configFile, []byte(configJSON), 0644))
d.Start(t, "--config-file", configFile)
@@ -293,7 +293,7 @@ func TestDaemonProxy(t *testing.T) {
d := daemon.New(t)
configFile := filepath.Join(d.RootDir(), "daemon.json")
- configJSON := fmt.Sprintf(`{"http-proxy":%[1]q, "https-proxy": %[1]q, "no-proxy": "example.com"}`, proxyRawURL)
+ configJSON := fmt.Sprintf(`{"proxies":{"http-proxy":%[1]q, "https-proxy": %[1]q, "no-proxy": "example.com"}}`, proxyRawURL)
assert.NilError(t, os.WriteFile(configFile, []byte(configJSON), 0644))
err := d.StartWithError("--http-proxy", proxyRawURL, "--https-proxy", proxyRawURL, "--no-proxy", "example.com", "--config-file", configFile, "--validate")