Files
docker-cli/cli/command/checkpoint/remove.go
Sebastiaan van Stijn b55fed5ef6 vendor: github.com/moby/moby/api v1.52.0-beta.1, client v0.1.0-beta.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Co-authored-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 22:41:03 +02:00

42 lines
1.0 KiB
Go

package checkpoint
import (
"context"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/moby/moby/client"
"github.com/spf13/cobra"
)
type removeOptions struct {
checkpointDir string
}
func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
var opts removeOptions
cmd := &cobra.Command{
Use: "rm [OPTIONS] CONTAINER CHECKPOINT",
Aliases: []string{"remove"},
Short: "Remove a checkpoint",
Args: cli.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
return runRemove(cmd.Context(), dockerCLI, args[0], args[1], opts)
},
DisableFlagsInUseLine: true,
}
flags := cmd.Flags()
flags.StringVar(&opts.checkpointDir, "checkpoint-dir", "", "Use a custom checkpoint storage directory")
return cmd
}
func runRemove(ctx context.Context, dockerCli command.Cli, container string, checkpointID string, opts removeOptions) error {
return dockerCli.Client().CheckpointDelete(ctx, container, client.CheckpointDeleteOptions{
CheckpointID: checkpointID,
CheckpointDir: opts.checkpointDir,
})
}