diff --git a/libcontainerd/remote/client.go b/libcontainerd/remote/client.go index 7b30e7a860..41eadac01d 100644 --- a/libcontainerd/remote/client.go +++ b/libcontainerd/remote/client.go @@ -145,7 +145,7 @@ func (c *client) NewContainer(ctx context.Context, id string, ociSpec *specs.Spe // Start create and start a task for the specified containerd id func (c *container) Start(ctx context.Context, checkpointDir string, withStdin bool, attachStdio libcontainerdtypes.StdioCallback) (libcontainerdtypes.Task, error) { var ( - cp *types.Descriptor + checkpoint *types.Descriptor t containerd.Task rio cio.IO stdinCloseSync = make(chan containerd.Process, 1) @@ -155,15 +155,15 @@ func (c *container) Start(ctx context.Context, checkpointDir string, withStdin b // write checkpoint to the content store tar := archive.Diff(ctx, "", checkpointDir) var err error - cp, err = c.client.writeContent(ctx, images.MediaTypeContainerd1Checkpoint, checkpointDir, tar) + checkpoint, err = c.client.writeContent(ctx, images.MediaTypeContainerd1Checkpoint, checkpointDir, tar) // remove the checkpoint when we're done defer func() { - if cp != nil { - err := c.client.client.ContentStore().Delete(ctx, cp.Digest) + if checkpoint != nil { + err := c.client.client.ContentStore().Delete(ctx, checkpoint.Digest) if err != nil { c.client.logger.WithError(err).WithFields(logrus.Fields{ "ref": checkpointDir, - "digest": cp.Digest, + "digest": checkpoint.Digest, }).Warnf("failed to delete temporary checkpoint entry") } } @@ -193,7 +193,7 @@ func (c *container) Start(ctx context.Context, checkpointDir string, withStdin b taskOpts := []containerd.NewTaskOpts{ func(_ context.Context, _ *containerd.Client, info *containerd.TaskInfo) error { - info.Checkpoint = cp + info.Checkpoint = checkpoint return nil }, }