Skip to content

Commit 71fde20

Browse files
committed
cli/command/system: prettyPrintServerInfo: simplify username
Starting with b4ca1c7, docker login no longer depends on info.IndexServerAddress to determine the default registry. The prettyPrintServerInfo() still depended on this information, which could potentially show the wrong information. This patch changes it to also depend on the same information as docker login now does. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 60d0659 commit 71fde20

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

cli/command/system/info.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/docker/docker/api/types"
2020
"github.com/docker/docker/api/types/swarm"
2121
"github.com/docker/docker/api/types/versions"
22+
"github.com/docker/docker/registry"
2223
"github.com/docker/go-units"
2324
"github.com/spf13/cobra"
2425
)
@@ -319,12 +320,8 @@ func prettyPrintServerInfo(dockerCli command.Cli, info types.Info) []error {
319320
fprintlnNonEmpty(dockerCli.Out(), " HTTPS Proxy:", info.HTTPSProxy)
320321
fprintlnNonEmpty(dockerCli.Out(), " No Proxy:", info.NoProxy)
321322

322-
if info.IndexServerAddress != "" {
323-
u := dockerCli.ConfigFile().AuthConfigs[info.IndexServerAddress].Username
324-
if len(u) > 0 {
325-
fmt.Fprintln(dockerCli.Out(), " Username:", u)
326-
}
327-
}
323+
u := dockerCli.ConfigFile().AuthConfigs[registry.IndexServer].Username
324+
fprintlnNonEmpty(dockerCli.Out(), " Username:", u)
328325

329326
if len(info.Labels) > 0 {
330327
fmt.Fprintln(dockerCli.Out(), " Labels:")

0 commit comments

Comments
 (0)