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

Function newAPIClientFromEndpoint

cli/command/cli.go:303–320  ·  view source on GitHub ↗
(ep docker.Endpoint, configFile *configfile.ConfigFile, extraOpts ...client.Opt)

Source from the content-addressed store, hash-verified

301}
302
303func newAPIClientFromEndpoint(ep docker.Endpoint, configFile *configfile.ConfigFile, extraOpts ...client.Opt) (client.APIClient, error) {
304 opts, err := ep.ClientOpts()
305 if err != nil {
306 return nil, err
307 }
308 if len(configFile.HTTPHeaders) > 0 {
309 opts = append(opts, client.WithHTTPHeaders(configFile.HTTPHeaders))
310 }
311 withCustomHeaders, err := withCustomHeadersFromEnv()
312 if err != nil {
313 return nil, err
314 }
315 if withCustomHeaders != nil {
316 opts = append(opts, withCustomHeaders)
317 }
318 opts = append(opts, extraOpts...)
319 return client.New(opts...)
320}
321
322func resolveDockerEndpoint(s store.Reader, contextName string) (docker.Endpoint, error) {
323 if s == nil {

Callers 2

NewAPIClientFromFlagsFunction · 0.85
initializeMethod · 0.85

Calls 2

withCustomHeadersFromEnvFunction · 0.85
ClientOptsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…