Restore take image

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2018-09-17 11:10:41 -04:00
parent 0e4d9da755
commit ce0673fd7d
2 changed files with 2 additions and 14 deletions

View File

@ -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 {

View File

@ -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
}