MCPcopy Index your code
hub / github.com/docker/cli / runInfo

Function runInfo

cli/command/system/info.go:85–114  ·  view source on GitHub ↗
(ctx context.Context, cmd *cobra.Command, dockerCli command.Cli, opts *infoOptions)

Source from the content-addressed store, hash-verified

83}
84
85func runInfo(ctx context.Context, cmd *cobra.Command, dockerCli command.Cli, opts *infoOptions) error {
86 info := dockerInfo{
87 ClientInfo: &clientInfo{
88 // Don't pass a dockerCLI to newClientVersion(), because we currently
89 // don't include negotiated API version, and want to avoid making an
90 // API connection when only printing the Client section.
91 clientVersion: newClientVersion(dockerCli.CurrentContext(), nil),
92 Debug: debug.IsEnabled(),
93 },
94 Info: &system.Info{},
95 }
96 if plugins, err := pluginmanager.ListPlugins(dockerCli, cmd.Root()); err == nil {
97 info.ClientInfo.Plugins = plugins
98 } else {
99 info.ClientErrors = append(info.ClientErrors, err.Error())
100 }
101
102 var serverConnErr error
103 if needsServerInfo(opts.format, info) {
104 serverConnErr = addServerInfo(ctx, dockerCli, opts.format, &info)
105 }
106
107 if opts.format == "" {
108 info.UserName = dockerCli.ConfigFile().AuthConfigs[registry.IndexServer].Username
109 info.ClientInfo.APIVersion = dockerCli.CurrentVersion()
110 return errors.Join(prettyPrintInfo(dockerCli, info), serverConnErr)
111 }
112
113 return errors.Join(serverConnErr, formatInfo(dockerCli.Out(), info, opts.format))
114}
115
116// addServerInfo retrieves the server information and adds it to the dockerInfo struct.
117// if a connection error occurs, it will be returned as an error.

Callers 1

newInfoCommandFunction · 0.85

Calls 10

newClientVersionFunction · 0.85
needsServerInfoFunction · 0.85
addServerInfoFunction · 0.85
prettyPrintInfoFunction · 0.85
formatInfoFunction · 0.85
CurrentContextMethod · 0.65
ConfigFileMethod · 0.65
CurrentVersionMethod · 0.65
OutMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…