Merge pull request #28042 from yongtang/28018-docker-info-swarm-managers

Add information for `Manager Addresses` in the output of `docker info`
This commit is contained in:
Victor Vieux 2016-11-11 09:30:01 -08:00 committed by GitHub
commit 460a7e213c
1 changed files with 12 additions and 0 deletions

View File

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