From 06a40f0f281b4679855a406bc202e122d2875949 Mon Sep 17 00:00:00 2001 From: Zhang Wentao Date: Tue, 3 Mar 2015 11:15:17 +0800 Subject: [PATCH] docker info display http/https_proxy setting Signed-off-by: Zhang Wentao --- api/client/commands.go | 10 +++++++++- daemon/info.go | 10 ++++++++++ docs/sources/reference/api/docker_remote_api.md | 6 ++++++ docs/sources/reference/api/docker_remote_api_v1.18.md | 3 +++ docs/sources/reference/commandline/cli.md | 3 +++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/api/client/commands.go b/api/client/commands.go index a4835bbeb3..1eeb2fdf59 100644 --- a/api/client/commands.go +++ b/api/client/commands.go @@ -590,7 +590,15 @@ func (cli *DockerCli) CmdInfo(args ...string) error { fmt.Fprintf(cli.out, "Docker Root Dir: %s\n", root) } } - + if remoteInfo.Exists("HttpProxy") { + fmt.Fprintf(cli.out, "Http Proxy: %s\n", remoteInfo.Get("HttpProxy")) + } + if remoteInfo.Exists("HttpsProxy") { + fmt.Fprintf(cli.out, "Https Proxy: %s\n", remoteInfo.Get("HttpsProxy")) + } + if remoteInfo.Exists("NoProxy") { + fmt.Fprintf(cli.out, "No Proxy: %s\n", remoteInfo.Get("NoProxy")) + } if len(remoteInfo.GetList("IndexServerAddress")) != 0 { cli.LoadConfigFile() u := cli.configFile.Configs[remoteInfo.Get("IndexServerAddress")].Username diff --git a/daemon/info.go b/daemon/info.go index f0fc1241b5..67ac048acf 100644 --- a/daemon/info.go +++ b/daemon/info.go @@ -87,6 +87,16 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) engine.Status { v.SetInt("NCPU", runtime.NumCPU()) v.SetInt64("MemTotal", meminfo.MemTotal) v.Set("DockerRootDir", daemon.Config().Root) + if http_proxy := os.Getenv("http_proxy"); http_proxy != "" { + v.Set("HttpProxy", http_proxy) + } + if https_proxy := os.Getenv("https_proxy"); https_proxy != "" { + v.Set("HttpsProxy", https_proxy) + } + if no_proxy := os.Getenv("no_proxy"); no_proxy != "" { + v.Set("NoProxy", no_proxy) + } + if hostname, err := os.Hostname(); err == nil { v.SetJson("Name", hostname) } diff --git a/docs/sources/reference/api/docker_remote_api.md b/docs/sources/reference/api/docker_remote_api.md index 4f844f4549..7cfdb468bd 100644 --- a/docs/sources/reference/api/docker_remote_api.md +++ b/docs/sources/reference/api/docker_remote_api.md @@ -57,6 +57,12 @@ This endpoint now returns `Os`, `Arch` and `KernelVersion`. **New!** You can set ulimit settings to be used within the container. +`Get /info` + +**New!** +Add return value `HttpProxy`,`HttpsProxy` and `NoProxy` to this entrypoint. + + ## v1.17 ### Full Documentation diff --git a/docs/sources/reference/api/docker_remote_api_v1.18.md b/docs/sources/reference/api/docker_remote_api_v1.18.md index d5d39fb6f2..ea0176c184 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.18.md +++ b/docs/sources/reference/api/docker_remote_api_v1.18.md @@ -1455,6 +1455,9 @@ Display system-wide information "IPv4Forwarding":true, "Labels":["storage=ssd"], "DockerRootDir": "/var/lib/docker", + "HttpProxy": "http://test:test@localhost:8080" + "HttpsProxy": "https://test:test@localhost:8080" + "NoProxy": "9.81.1.160" "OperatingSystem": "Boot2Docker", } diff --git a/docs/sources/reference/commandline/cli.md b/docs/sources/reference/commandline/cli.md index eb61872dae..8ffaa5adc3 100644 --- a/docs/sources/reference/commandline/cli.md +++ b/docs/sources/reference/commandline/cli.md @@ -1241,6 +1241,9 @@ For example: EventsListeners: 0 Init Path: /usr/bin/docker Docker Root Dir: /var/lib/docker + Http Proxy: http://test:test@localhost:8080 + Https Proxy: https://test:test@localhost:8080 + No Proxy: 9.81.1.160 Username: svendowideit Registry: [https://index.docker.io/v1/] Labels: