MCPcopy Create free account
hub / github.com/docker/cli / newRegistryClient

Function newRegistryClient

cli/command/manifest/annotate.go:74–96  ·  view source on GitHub ↗

newRegistryClient returns a client for communicating with a Docker distribution registry

(dockerCLI command.Cli, allowInsecure bool)

Source from the content-addressed store, hash-verified

72// newRegistryClient returns a client for communicating with a Docker distribution
73// registry
74func newRegistryClient(dockerCLI command.Cli, allowInsecure bool) registryclient.RegistryClient {
75 if msp, ok := dockerCLI.(manifestStoreProvider); ok {
76 // manifestStoreProvider is used in tests to provide a dummy store.
77 return msp.RegistryClient(allowInsecure)
78 }
79 cfg := dockerCLI.ConfigFile()
80 resolver := func(ctx context.Context, domainName string) registry.AuthConfig {
81 configKey := getAuthConfigKey(domainName)
82 a, _ := cfg.GetAuthConfig(configKey)
83 return registry.AuthConfig{
84 Username: a.Username,
85 Password: a.Password,
86 ServerAddress: a.ServerAddress,
87
88 // TODO(thaJeztah): Are these expected to be included?
89 Auth: a.Auth,
90 IdentityToken: a.IdentityToken,
91 RegistryToken: a.RegistryToken,
92 }
93 }
94 // FIXME(thaJeztah): this should use the userAgent as configured on the dockerCLI.
95 return registryclient.NewRegistryClient(resolver, command.UserAgent(), allowInsecure)
96}
97
98// NewAnnotateCommand creates a new `docker manifest annotate` command
99func newAnnotateCommand(dockerCLI command.Cli) *cobra.Command {

Callers 3

pushListFunction · 0.85
runInspectFunction · 0.85
getManifestFunction · 0.85

Calls 4

GetAuthConfigMethod · 0.80
getAuthConfigKeyFunction · 0.70
RegistryClientMethod · 0.65
ConfigFileMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…