Restore take image
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
0e4d9da755
commit
ce0673fd7d
14
client.go
14
client.go
@ -523,19 +523,7 @@ func (c *Client) ListImages(ctx context.Context, filters ...string) ([]Image, er
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restore restores a container from a checkpoint
|
// Restore restores a container from a checkpoint
|
||||||
func (c *Client) Restore(ctx context.Context, id, ref string, opts ...RestoreOpts) (Container, error) {
|
func (c *Client) Restore(ctx context.Context, id string, checkpoint Image, 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)
|
|
||||||
}
|
|
||||||
|
|
||||||
store := c.ContentStore()
|
store := c.ContentStore()
|
||||||
index, err := decodeIndex(ctx, store, checkpoint.Target())
|
index, err := decodeIndex(ctx, store, checkpoint.Target())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -383,7 +383,7 @@ var restoreCommand = cli.Command{
|
|||||||
containerd.WithRestoreRuntime,
|
containerd.WithRestoreRuntime,
|
||||||
}
|
}
|
||||||
|
|
||||||
ctr, err := client.Restore(ctx, id, ref, opts...)
|
ctr, err := client.Restore(ctx, id, checkpoint, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user