docker info display http/https_proxy setting

Signed-off-by: Zhang Wentao <zhangwentao234@huawei.com>
This commit is contained in:
Zhang Wentao 2015-03-03 11:15:17 +08:00
parent 92e632c84e
commit 06a40f0f28
5 changed files with 31 additions and 1 deletions

View File

@ -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

View File

@ -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)
}

View File

@ -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

View File

@ -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",
}

View File

@ -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: