(dockerCLI command.Cli)
| 18 | } |
| 19 | |
| 20 | func 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 | |
| 43 | func runCreate(ctx context.Context, dockerCLI command.Cli, opts createOptions) error { |
| 44 | _, err := dockerCLI.Client().CheckpointCreate(ctx, opts.container, client.CheckpointCreateOptions{ |
searching dependent graphs…