summaryrefslogtreecommitdiff
path: root/libpod/image/image.go
diff options
context:
space:
mode:
authorQi Wang <qiwan@redhat.com>2020-07-07 10:35:33 -0400
committerQi Wang <qiwan@redhat.com>2020-07-09 08:03:54 -0400
commita1d6114177874125550890c0e4b30a98fc6d304e (patch)
tree1ffbbf205bfd1a537ce36dc5f891091cc4938228 /libpod/image/image.go
parentedf5fe8b17f39ce98805c279b9795bfd4123abe2 (diff)
downloadpodman-a1d6114177874125550890c0e4b30a98fc6d304e.tar.gz
podman-a1d6114177874125550890c0e4b30a98fc6d304e.tar.bz2
podman-a1d6114177874125550890c0e4b30a98fc6d304e.zip
Fix saving in oci format
- fix saving&loading oci format. Close #6544 - support loading using image name without "localhost/" prefix when reading from ociarchive/dir saved from this semantics Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Signed-off-by: Qi Wang <qiwan@redhat.com>
Diffstat (limited to 'libpod/image/image.go')
-rw-r--r--libpod/image/image.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go
index 048ec825d..e2bd1ad5d 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -21,6 +21,7 @@ import (
"github.com/containers/image/v5/image"
"github.com/containers/image/v5/manifest"
ociarchive "github.com/containers/image/v5/oci/archive"
+ "github.com/containers/image/v5/oci/layout"
is "github.com/containers/image/v5/storage"
"github.com/containers/image/v5/tarball"
"github.com/containers/image/v5/transports"
@@ -1483,9 +1484,10 @@ func (i *Image) Save(ctx context.Context, source, format, output string, moreTag
return errors.Wrapf(err, "error getting OCI archive ImageReference for (%q, %q)", output, destImageName)
}
case "oci-dir":
- destRef, err = directory.NewReference(output)
+ destImageName := imageNameForSaveDestination(i, source)
+ destRef, err = layout.NewReference(output, destImageName) // destImageName may be ""
if err != nil {
- return errors.Wrapf(err, "error getting directory ImageReference for %q", output)
+ return errors.Wrapf(err, "error getting the OCI directory ImageReference for (%q, %q)", output, destImageName)
}
manifestType = imgspecv1.MediaTypeImageManifest
case "docker-dir":