Skip to content

Commit

Permalink
Merge pull request moby#28042 from yongtang/28018-docker-info-swarm-m…
Browse files Browse the repository at this point in the history
…anagers

Add information for `Manager Addresses` in the output of `docker info`
  • Loading branch information
vieux committed Nov 11, 2016
2 parents 356ff43 + cd71257 commit 460a7e2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions command/system/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package system

import (
"fmt"
"sort"
"strings"
"time"

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 460a7e2

Please sign in to comment.