diff options
-rw-r--r-- | pkg/adapter/checkpoint_restore.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/adapter/checkpoint_restore.go b/pkg/adapter/checkpoint_restore.go index 9df1704ea..4ca17dd93 100644 --- a/pkg/adapter/checkpoint_restore.go +++ b/pkg/adapter/checkpoint_restore.go @@ -5,10 +5,12 @@ package adapter import ( "context" "github.com/containers/libpod/libpod" + "github.com/containers/libpod/libpod/image" "github.com/containers/storage/pkg/archive" jsoniter "github.com/json-iterator/go" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" + "io" "io/ioutil" "os" "path/filepath" @@ -83,6 +85,20 @@ func crImportCheckpoint(ctx context.Context, runtime *libpod.Runtime, input stri return nil, errors.Errorf("Cannot import checkpoints of containers with named volumes or dependencies") } + // The code to load the images is copied from create.go + var writer io.Writer + // In create.go this only set if '--quiet' does not exist. + writer = os.Stderr + rtc, err := runtime.GetConfig() + if err != nil { + return nil, err + } + + _, err = runtime.ImageRuntime().New(ctx, config.RootfsImageName, rtc.SignaturePolicyPath, "", writer, nil, image.SigningOptions{}, false, nil) + if err != nil { + return nil, err + } + // Now create a new container from the just loaded information container, err := runtime.RestoreContainer(ctx, spec, config) if err != nil { |