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

Function resolveDefaultDockerEndpoint

cli/command/cli.go:338–367  ·  view source on GitHub ↗

Resolve the Docker endpoint for the default context (based on config, env vars and CLI flags)

(opts *cliflags.ClientOptions)

Source from the content-addressed store, hash-verified

336
337// Resolve the Docker endpoint for the default context (based on config, env vars and CLI flags)
338func resolveDefaultDockerEndpoint(opts *cliflags.ClientOptions) (docker.Endpoint, error) {
339 // defaultToTLS determines whether we should use a TLS host as default
340 // if nothing was configured by the user.
341 defaultToTLS := opts.TLSOptions != nil
342 host, err := getServerHost(opts.Hosts, defaultToTLS)
343 if err != nil {
344 return docker.Endpoint{}, err
345 }
346
347 var (
348 skipTLSVerify bool
349 tlsData *dcontext.TLSData
350 )
351
352 if opts.TLSOptions != nil {
353 skipTLSVerify = opts.TLSOptions.InsecureSkipVerify
354 tlsData, err = dcontext.TLSDataFromFiles(opts.TLSOptions.CAFile, opts.TLSOptions.CertFile, opts.TLSOptions.KeyFile)
355 if err != nil {
356 return docker.Endpoint{}, err
357 }
358 }
359
360 return docker.Endpoint{
361 EndpointMeta: docker.EndpointMeta{
362 Host: host,
363 SkipTLSVerify: skipTLSVerify,
364 },
365 TLSData: tlsData,
366 }, nil
367}
368
369func (cli *DockerCli) getInitTimeout() time.Duration {
370 if cli.initTimeout != 0 {

Callers 2

getDockerEndPointMethod · 0.85
resolveDefaultContextFunction · 0.85

Calls 1

getServerHostFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…