From cc03743c0fd9d698a58e52d59cc7d9b0396b8e74 Mon Sep 17 00:00:00 2001
From: baude <bbaude@redhat.com>
Date: Thu, 19 Apr 2018 08:19:14 -0500
Subject: [PATCH] Strip transport from image name when looking for local image

When a user pulls an image using a transport, like docker-daemon, we try to lookup
the new image in storage by the input name after the pull.  Because the input name
has a transport (different than local storage), that lookup would fail.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #644
Approved by: rhatdan
---
 libpod/image/image.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libpod/image/image.go b/libpod/image/image.go
index c9f03ebef6..4d481c8e5c 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -183,6 +183,12 @@ func (i *Image) getLocalImage() (*storage.Image, error) {
 	if i.InputName == "" {
 		return nil, errors.Errorf("input name is blank")
 	}
+	// Check if the input name has a transport and if so strip it
+	dest, err := alltransports.ParseImageName(i.InputName)
+	if err == nil && dest.DockerReference() != nil {
+		i.InputName = dest.DockerReference().String()
+	}
+
 	var taggedName string
 	img, err := i.imageruntime.getImage(stripSha256(i.InputName))
 	if err == nil {