Skip to content

Commit 533889c

Browse files
authored
Merge pull request #1263 from adrianreber/2023-09-11-checkpoint-export
Verify required checkpoint parameters are set
2 parents b871c4f + 04fb3af commit 533889c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Diff for: cmd/crictl/container.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -618,13 +618,19 @@ var checkpointContainerCommand = &cli.Command{
618618
&cli.StringFlag{
619619
Name: "export",
620620
Aliases: []string{"e"},
621-
Usage: "Specify the name of the archive used to export the checkpoint image.",
621+
Usage: "Specify the name of the tar archive (/path/to/checkpoint.tar) used to export the checkpoint image.",
622622
},
623623
},
624624
Action: func(c *cli.Context) error {
625625
if c.NArg() == 0 {
626626
return fmt.Errorf("ID cannot be empty")
627627
}
628+
if c.String("export") == "" {
629+
return fmt.Errorf(
630+
"Cannot checkpoint a container without specifying the checkpoint destination. " +
631+
"Use --export=/path/to/checkpoint.tar",
632+
)
633+
}
628634
runtimeClient, err := getRuntimeService(c, 0)
629635
if err != nil {
630636
return err

Diff for: docs/crictl.md

+9
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,15 @@ CONTAINER IMAGE CREATED STATE
369369
b25b4f26e3429 busybox:latest 14 seconds ago Running busybox 0 158d7a6665ff3
370370
```
371371

372+
### Checkpoint a running container
373+
374+
```sh
375+
$ crictl checkpoint --export=/path/to/checkpoint.tar 39fcdd7a4f1d4
376+
39fcdd7a4f1d4
377+
$ ls /path/to/checkpoint.tar
378+
/path/to/checkpoint.tar
379+
```
380+
372381
## More information
373382

374383
* See the [Kubernetes.io Debugging Kubernetes nodes with crictl doc](https://kubernetes.io/docs/tasks/debug-application-cluster/crictl/)

0 commit comments

Comments
 (0)