mirror of
https://github.com/docker/cli.git
synced 2026-01-18 08:21:31 +03:00
Add information for Manager Addresses in the output of docker info
As is specified in 28018, it would be useful to know the manager's addresses
even in a worker node. This is especially useful when there are many
worker nodes in a big cluster.
The information is available in `info.Swarm.RemoteManagers`.
This fix add the information of `Manager Addresses` to the output
of `docker info`, to explicitly show it.
A test has been added for this fix.
This fix fixes 28018.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: cd71257cfd
Component: cli
This commit is contained in:
@@ -2,6 +2,7 @@ package system
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -131,6 +132,17 @@ func prettyPrintInfo(dockerCli *command.DockerCli, info types.Info) error {
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(dockerCli.Out(), " Node Address: %s\n", info.Swarm.NodeAddr)
|
||||
managers := []string{}
|
||||
for _, entry := range info.Swarm.RemoteManagers {
|
||||
managers = append(managers, entry.Addr)
|
||||
}
|
||||
if len(managers) > 0 {
|
||||
sort.Strings(managers)
|
||||
fmt.Fprintf(dockerCli.Out(), " Manager Addresses:\n")
|
||||
for _, entry := range managers {
|
||||
fmt.Fprintf(dockerCli.Out(), " %s\n", entry)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(info.Runtimes) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user