diff options
author | haircommander <pehunt@redhat.com> | 2018-07-13 17:45:55 -0400 |
---|---|---|
committer | haircommander <pehunt@redhat.com> | 2018-07-20 11:46:11 -0400 |
commit | 0fecfeee6398e2db6b7b3fd257645a6ea9aab542 (patch) | |
tree | 0c8bc2bc742ae2001f992c777ab0ac4d46947553 /libpod/image/image.go | |
parent | ba1871dac033783ab0329c9b3c9113a34a90992f (diff) | |
download | podman-0fecfeee6398e2db6b7b3fd257645a6ea9aab542.tar.gz podman-0fecfeee6398e2db6b7b3fd257645a6ea9aab542.tar.bz2 podman-0fecfeee6398e2db6b7b3fd257645a6ea9aab542.zip |
Podman load/tag/save prepend localhost when no repository is present
Instead of having docker.io/library as its repository. Test included.
Signed-off-by: haircommander <pehunt@redhat.com>
Diffstat (limited to 'libpod/image/image.go')
-rw-r--r-- | libpod/image/image.go | 10 |
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 |