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

Function newCreateCommand

cli/command/checkpoint/create.go:20–41  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

18}
19
20func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
21 var opts createOptions
22
23 cmd := &cobra.Command{
24 Use: "create [OPTIONS] CONTAINER CHECKPOINT",
25 Short: "Create a checkpoint from a running container",
26 Args: cli.ExactArgs(2),
27 RunE: func(cmd *cobra.Command, args []string) error {
28 opts.container = args[0]
29 opts.checkpoint = args[1]
30 return runCreate(cmd.Context(), dockerCLI, opts)
31 },
32 ValidArgsFunction: cobra.NoFileCompletions,
33 DisableFlagsInUseLine: true,
34 }
35
36 flags := cmd.Flags()
37 flags.BoolVar(&opts.leaveRunning, "leave-running", false, "Leave the container running after checkpoint")
38 flags.StringVar(&opts.checkpointDir, "checkpoint-dir", "", "Use a custom checkpoint storage directory")
39
40 return cmd
41}
42
43func runCreate(ctx context.Context, dockerCLI command.Cli, opts createOptions) error {
44 _, err := dockerCLI.Client().CheckpointCreate(ctx, opts.container, client.CheckpointCreateOptions{

Callers 3

newCheckpointCommandFunction · 0.70

Calls 1

runCreateFunction · 0.70

Tested by 2

Used in the wild real call sites across dependent graphs

searching dependent graphs…