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

Function newExportCommand

cli/command/container/export.go:23–46  ·  view source on GitHub ↗

newExportCommand creates a new "docker container export" command.

(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

21
22// newExportCommand creates a new "docker container export" command.
23func newExportCommand(dockerCLI command.Cli) *cobra.Command {
24 var opts exportOptions
25
26 cmd := &cobra.Command{
27 Use: "export [OPTIONS] CONTAINER",
28 Short: "Export a container's filesystem as a tar archive",
29 Args: cli.ExactArgs(1),
30 RunE: func(cmd *cobra.Command, args []string) error {
31 opts.container = args[0]
32 return runExport(cmd.Context(), dockerCLI, opts)
33 },
34 Annotations: map[string]string{
35 "aliases": "docker container export, docker export",
36 },
37 ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
38 DisableFlagsInUseLine: true,
39 }
40
41 flags := cmd.Flags()
42
43 flags.StringVarP(&opts.output, "output", "o", "", "Write to a file, instead of STDOUT")
44
45 return cmd
46}
47
48func runExport(ctx context.Context, dockerCLI command.Cli, opts exportOptions) error {
49 var output io.Writer

Calls 1

runExportFunction · 0.70

Used in the wild real call sites across dependent graphs

searching dependent graphs…