cmd/ctr: create an image for checkpoint
This allows one to manage the checkpoints by using the `ctr image` command. The image is created with label "containerd.io/checkpoint". By default, it is not included in the output of `ctr images ls`. We can list the images by using the following command: $ ctr images ls labels.containerd.\"io/checkpoint\"==true Fixes #1026 Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
This commit is contained in:
committed by
Michael Crosby
parent
70b5668351
commit
abbec62620
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
@@ -48,6 +49,19 @@ var taskCheckpointCommand = cli.Command{
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
labels := map[string]string{
|
||||
"containerd.io/checkpoint": "true",
|
||||
}
|
||||
img := images.Image{
|
||||
Name: checkpoint.Digest.String(),
|
||||
Target: checkpoint,
|
||||
Labels: labels,
|
||||
}
|
||||
_, err = client.ImageService().Create(ctx, img)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(checkpoint.Digest.String())
|
||||
return nil
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user