summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2019-04-15 18:45:52 +0000
committerAdrian Reber <areber@redhat.com>2019-06-03 22:05:13 +0200
commit0e072f9a9785c67f38859ab989267397b57154c8 (patch)
treee1450614a768cc14eb7a3831a5d969fbe87d3185 /pkg
parenta4d33330d6886ab90f7d90ef686f2eee4dda683b (diff)
downloadpodman-0e072f9a9785c67f38859ab989267397b57154c8.tar.gz
podman-0e072f9a9785c67f38859ab989267397b57154c8.tar.bz2
podman-0e072f9a9785c67f38859ab989267397b57154c8.zip
Also download container images during restore
If restoring a container from a checkpoint it was necessary that the image the container is based was already available (podman pull). This commit adds the image download to podman container restore if it does not exist. Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/checkpoint_restore.go16
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 {