diff --git a/client.go b/client.go index 01c1c2441..1566ef110 100644 --- a/client.go +++ b/client.go @@ -523,19 +523,7 @@ func (c *Client) ListImages(ctx context.Context, filters ...string) ([]Image, er } // Restore restores a container from a checkpoint -func (c *Client) Restore(ctx context.Context, id, ref string, opts ...RestoreOpts) (Container, error) { - checkpoint, err := c.GetImage(ctx, ref) - if err != nil { - if !errdefs.IsNotFound(err) { - return nil, err - } - ck, err := c.Fetch(ctx, ref) - if err != nil { - return nil, err - } - checkpoint = NewImage(c, ck) - } - +func (c *Client) Restore(ctx context.Context, id string, checkpoint Image, opts ...RestoreOpts) (Container, error) { store := c.ContentStore() index, err := decodeIndex(ctx, store, checkpoint.Target()) if err != nil { diff --git a/cmd/ctr/commands/containers/containers.go b/cmd/ctr/commands/containers/containers.go index 44a80b63a..a0420a44f 100644 --- a/cmd/ctr/commands/containers/containers.go +++ b/cmd/ctr/commands/containers/containers.go @@ -383,7 +383,7 @@ var restoreCommand = cli.Command{ containerd.WithRestoreRuntime, } - ctr, err := client.Restore(ctx, id, ref, opts...) + ctr, err := client.Restore(ctx, id, checkpoint, opts...) if err != nil { return err }