summaryrefslogtreecommitdiff
path: root/libpod/image/image.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-07-20 12:50:18 -0400
committerGitHub <noreply@github.com>2018-07-20 12:50:18 -0400
commit6cae4a0e94cf2ee66687ee0cbf553270396c2d5c (patch)
treea383b1728be7a00732a16ba7e3a504e5ebce3766 /libpod/image/image.go
parent7944bca4681893971ad6bda4ade4e1b3470b9559 (diff)
parent0fecfeee6398e2db6b7b3fd257645a6ea9aab542 (diff)
downloadpodman-6cae4a0e94cf2ee66687ee0cbf553270396c2d5c.tar.gz
podman-6cae4a0e94cf2ee66687ee0cbf553270396c2d5c.tar.bz2
podman-6cae4a0e94cf2ee66687ee0cbf553270396c2d5c.zip
Merge pull request #1103 from haircommander/load_dockerless
Podman load/tag/save prepends localhost when no registry is present
Diffstat (limited to 'libpod/image/image.go')
-rw-r--r--libpod/image/image.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go
index b5c4c537f..3863338b5 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -260,6 +260,12 @@ func (i *Image) getLocalImage() (*storage.Image, error) {
if hasReg {
return nil, errors.Errorf("%s", imageError)
}
+ // if the image is saved with the repository localhost, searching with localhost prepended is necessary
+ // We don't need to strip the sha because we have already determined it is not an ID
+ img, err = i.imageruntime.getImage(DefaultLocalRepo + "/" + i.InputName)
+ if err == nil {
+ return img.image, err
+ }
// grab all the local images
images, err := i.imageruntime.GetImages()
@@ -462,6 +468,10 @@ func (i *Image) TagImage(tag string) error {
if !decomposedTag.isTagged {
tag = fmt.Sprintf("%s:%s", tag, decomposedTag.tag)
}
+ // If the input doesn't specify a registry, set the registry to localhost
+ if !decomposedTag.hasRegistry {
+ tag = fmt.Sprintf("%s/%s", DefaultLocalRepo, tag)
+ }
tags := i.Names()
if util.StringInSlice(tag, tags) {
return nil