summaryrefslogtreecommitdiff
path: root/libpod/image
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2018-05-16 11:41:08 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-16 18:06:52 +0000
commit7dced311d1119d98dbdd60f6d47fdde5abbff7d7 (patch)
treebc914183a3918fa79ebfb248fbdff2771d6a3f13 /libpod/image
parent5c54c53534d3e09a99341864f1c0c96a1f0ad0fe (diff)
downloadpodman-7dced311d1119d98dbdd60f6d47fdde5abbff7d7.tar.gz
podman-7dced311d1119d98dbdd60f6d47fdde5abbff7d7.tar.bz2
podman-7dced311d1119d98dbdd60f6d47fdde5abbff7d7.zip
Allow push/save without image reference
If the user uses the image ID when saving to either docker-archive or oci-archive, then do not save a reference in the manifest/index.json. If the user chooses to push without an image reference, i.e <transport>:<path> it should be valid and succeed. Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #782 Approved by: rhatdan
Diffstat (limited to 'libpod/image')
-rw-r--r--libpod/image/pull.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index 2746d1bc5..38a8435de 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -123,10 +123,18 @@ func (ir *Runtime) getPullListFromRef(ctx context.Context, srcRef types.ImageRef
return nil, errors.Wrapf(err, "error loading manifest for %q", srcRef)
}
+ var dest string
if manifest.Annotations == nil || manifest.Annotations["org.opencontainers.image.ref.name"] == "" {
- return nil, errors.Errorf("error, archive doesn't have a name annotation. Cannot store image with no name")
+ // If the input image has no image.ref.name, we need to feed it a dest anyways
+ // use the hex of the digest
+ dest, err = getImageDigest(ctx, srcRef, sc)
+ if err != nil {
+ return nil, errors.Wrapf(err, "error getting image digest; image reference not found")
+ }
+ } else {
+ dest = manifest.Annotations["org.opencontainers.image.ref.name"]
}
- pullInfo, err := ir.getPullStruct(srcRef, manifest.Annotations["org.opencontainers.image.ref.name"])
+ pullInfo, err := ir.getPullStruct(srcRef, dest)
if err != nil {
return nil, err
}