From 0fecfeee6398e2db6b7b3fd257645a6ea9aab542 Mon Sep 17 00:00:00 2001 From: haircommander Date: Fri, 13 Jul 2018 17:45:55 -0400 Subject: 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 --- libpod/image/image.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libpod/image/image.go') 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 -- cgit v1.2.3-54-g00ecf