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

Function newLoadCommand

cli/command/image/load.go:27–53  ·  view source on GitHub ↗

newLoadCommand creates a new "docker image load" command.

(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

25
26// newLoadCommand creates a new "docker image load" command.
27func newLoadCommand(dockerCLI command.Cli) *cobra.Command {
28 var opts loadOptions
29
30 cmd := &cobra.Command{
31 Use: "load [OPTIONS]",
32 Short: "Load an image from a tar archive or STDIN",
33 Args: cli.NoArgs,
34 RunE: func(cmd *cobra.Command, args []string) error {
35 return runLoad(cmd.Context(), dockerCLI, opts)
36 },
37 Annotations: map[string]string{
38 "aliases": "docker image load, docker load",
39 },
40 ValidArgsFunction: cobra.NoFileCompletions,
41 DisableFlagsInUseLine: true,
42 }
43
44 flags := cmd.Flags()
45
46 flags.StringVarP(&opts.input, "input", "i", "", "Read from tar archive file, instead of STDIN")
47 flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress the load output")
48 flags.StringSliceVar(&opts.platform, "platform", []string{}, `Load only the given platform(s). Formatted as a comma-separated list of "os[/arch[/variant]]" (e.g., "linux/amd64,linux/arm64/v8").`)
49 _ = flags.SetAnnotation("platform", "version", []string{"1.48"})
50
51 _ = cmd.RegisterFlagCompletionFunc("platform", completion.Platforms())
52 return cmd
53}
54
55func runLoad(ctx context.Context, dockerCli command.Cli, opts loadOptions) error {
56 var input io.Reader = dockerCli.In()

Callers 4

TestNewLoadCommandErrorsFunction · 0.85
newImageCommandFunction · 0.85

Calls 1

runLoadFunction · 0.85

Tested by 3

TestNewLoadCommandErrorsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…