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

Function NewDockerCli

cli/command/cli.go:568–584  ·  view source on GitHub ↗

NewDockerCli returns a DockerCli instance with all operators applied on it. It applies by default the standard streams, and the content trust from environment.

(ops ...CLIOption)

Source from the content-addressed store, hash-verified

566// It applies by default the standard streams, and the content trust from
567// environment.
568func NewDockerCli(ops ...CLIOption) (*DockerCli, error) {
569 defaultOps := make([]CLIOption, 0, 3+len(ops))
570 defaultOps = append(defaultOps,
571 WithDefaultContextStoreConfig(),
572 WithStandardStreams(),
573 WithUserAgent(UserAgent()),
574 )
575 ops = append(defaultOps, ops...)
576
577 cli := &DockerCli{baseCtx: context.Background()}
578 for _, op := range ops {
579 if err := op(cli); err != nil {
580 return nil, err
581 }
582 }
583 return cli, nil
584}
585
586func getServerHost(hosts []string, defaultToTLS bool) (string, error) {
587 switch len(hosts) {

Calls 4

WithStandardStreamsFunction · 0.85
WithUserAgentFunction · 0.85
UserAgentFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…