From 713c08630beff2c3ce4eabeab6dbf5b6dd6fff45 Mon Sep 17 00:00:00 2001 From: umohnani8 Date: Thu, 8 Mar 2018 14:59:19 -0500 Subject: Podman load can pull in compressed files Podman load can now load in docker-archive files that are compressed. Signed-off-by: umohnani8 Closes: #468 Approved by: baude --- libpod/runtime_img.go | 5 ++++- test/e2e/load_test.go | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go index 8d2c3a1d6..06bd474d6 100644 --- a/libpod/runtime_img.go +++ b/libpod/runtime_img.go @@ -606,7 +606,10 @@ func (r *Runtime) getPullListFromRef(srcRef types.ImageReference, imgName string // supports pulling from docker-archive, oci, and registries if srcRef.Transport().Name() == DockerArchive { - tarSource := tarfile.NewSource(archFile) + tarSource, err := tarfile.NewSourceFromFile(archFile) + if err != nil { + return nil, err + } manifest, err := tarSource.LoadTarManifest() if err != nil { return nil, errors.Errorf("error retrieving manifest.json: %v", err) diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go index e36883b16..e9c2d94ab 100644 --- a/test/e2e/load_test.go +++ b/test/e2e/load_test.go @@ -44,6 +44,26 @@ var _ = Describe("Podman load", func() { Expect(result.ExitCode()).To(Equal(0)) }) + It("podman load compressed tar file", func() { + outfile := filepath.Join(podmanTest.TempDir, "alpine.tar") + + save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) + save.WaitWithDefaultTimeout() + Expect(save.ExitCode()).To(Equal(0)) + + compress := podmanTest.SystemExec("gzip", []string{outfile}) + compress.WaitWithDefaultTimeout() + outfile = outfile + ".gz" + + rmi := podmanTest.Podman([]string{"rmi", ALPINE}) + rmi.WaitWithDefaultTimeout() + Expect(rmi.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"load", "-i", outfile}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + }) + It("podman load oci-archive image", func() { outfile := filepath.Join(podmanTest.TempDir, "alpine.tar") -- cgit v1.2.3-54-g00ecf