diff options
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 |