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

Function newPullCommand

cli/command/image/pull.go:31–66  ·  view source on GitHub ↗

newPullCommand creates a new `docker pull` command

(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

29
30// newPullCommand creates a new `docker pull` command
31func newPullCommand(dockerCLI command.Cli) *cobra.Command {
32 var opts pullOptions
33
34 cmd := &cobra.Command{
35 Use: "pull [OPTIONS] NAME[:TAG|@DIGEST]",
36 Short: "Download an image from a registry",
37 Args: cli.ExactArgs(1),
38 RunE: func(cmd *cobra.Command, args []string) error {
39 opts.remote = args[0]
40 return runPull(cmd.Context(), dockerCLI, opts)
41 },
42 Annotations: map[string]string{
43 "category-top": "5",
44 "aliases": "docker image pull, docker pull",
45 },
46 // Complete with local images to help pulling the latest version
47 // of images that are in the image cache.
48 ValidArgsFunction: completion.ImageNames(dockerCLI, 1),
49 DisableFlagsInUseLine: true,
50 }
51
52 flags := cmd.Flags()
53
54 flags.BoolVarP(&opts.all, "all-tags", "a", false, "Download all tagged images in the repository")
55 flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress verbose output")
56
57 // TODO(thaJeztah): DEPRECATED: remove in v29.1 or v30
58 flags.Bool("disable-content-trust", true, "Skip image verification (deprecated)")
59 _ = flags.MarkDeprecated("disable-content-trust", "support for docker content trust was removed")
60
61 flags.StringVar(&opts.platform, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable")
62 _ = flags.SetAnnotation("platform", "version", []string{"1.32"})
63 _ = cmd.RegisterFlagCompletionFunc("platform", completion.Platforms())
64
65 return cmd
66}
67
68// runPull performs a pull against the engine based on the specified options
69func runPull(ctx context.Context, dockerCLI command.Cli, opts pullOptions) error {

Callers 3

newImageCommandFunction · 0.85
TestNewPullCommandErrorsFunction · 0.85

Calls 1

runPullFunction · 0.85

Tested by 2

TestNewPullCommandErrorsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…