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

Function runPush

cli/command/plugin/push.go:35–60  ·  view source on GitHub ↗
(ctx context.Context, dockerCli command.Cli, name string)

Source from the content-addressed store, hash-verified

33}
34
35func runPush(ctx context.Context, dockerCli command.Cli, name string) error {
36 named, err := reference.ParseNormalizedNamed(name)
37 if err != nil {
38 return err
39 }
40 if _, ok := named.(reference.Canonical); ok {
41 return fmt.Errorf("invalid name: %s", name)
42 }
43
44 named = reference.TagNameOnly(named)
45 encodedAuth, err := command.RetrieveAuthTokenFromImage(dockerCli.ConfigFile(), named.String())
46 if err != nil {
47 return err
48 }
49
50 responseBody, err := dockerCli.Client().PluginPush(ctx, reference.FamiliarString(named), client.PluginPushOptions{
51 RegistryAuth: encodedAuth,
52 })
53 if err != nil {
54 return err
55 }
56 defer func() {
57 _ = responseBody.Close()
58 }()
59 return jsonstream.Display(ctx, responseBody, dockerCli.Out())
60}

Callers 1

newPushCommandFunction · 0.70

Calls 5

ConfigFileMethod · 0.65
StringMethod · 0.65
ClientMethod · 0.65
OutMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…