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

Function newTagCommand

cli/command/image/tag.go:12–35  ·  view source on GitHub ↗

newTagCommand creates a new "docker image tag" command.

(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

10
11// newTagCommand creates a new "docker image tag" command.
12func newTagCommand(dockerCLI command.Cli) *cobra.Command {
13 cmd := &cobra.Command{
14 Use: "tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]",
15 Short: "Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE",
16 Args: cli.ExactArgs(2),
17 RunE: func(cmd *cobra.Command, args []string) error {
18 _, err := dockerCLI.Client().ImageTag(cmd.Context(), client.ImageTagOptions{
19 Source: args[0],
20 Target: args[1],
21 })
22 return err
23 },
24 Annotations: map[string]string{
25 "aliases": "docker image tag, docker tag",
26 },
27 ValidArgsFunction: completion.ImageNames(dockerCLI, 2),
28 DisableFlagsInUseLine: true,
29 }
30
31 flags := cmd.Flags()
32 flags.SetInterspersed(false)
33
34 return cmd
35}

Callers 3

newImageCommandFunction · 0.85
TestCliNewTagCommandFunction · 0.85

Calls 2

ImageTagMethod · 0.80
ClientMethod · 0.65

Tested by 2

TestCliNewTagCommandFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…