From e7748cba6e9fa9d45904436e0d9b21d67b775d3d Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Fri, 24 Mar 2017 11:34:12 -0400 Subject: [PATCH] Preserve the tag of the pulled image's name When we pull an image, preserve the tag portion of the name that we were asked to use for pulling it, instead of unconditionally replacing it with "latest". Signed-off-by: Nalin Dahyabhai --- pkg/storage/image.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/storage/image.go b/pkg/storage/image.go index 4901d3e1..335c91eb 100644 --- a/pkg/storage/image.go +++ b/pkg/storage/image.go @@ -2,6 +2,7 @@ package storage import ( "github.com/containers/image/copy" + "github.com/containers/image/docker/reference" "github.com/containers/image/signature" istorage "github.com/containers/image/storage" "github.com/containers/image/transports/alltransports" @@ -132,6 +133,9 @@ func (svc *imageService) PullImage(systemContext *types.SystemContext, imageName dest := imageName if srcRef.DockerReference() != nil { dest = srcRef.DockerReference().Name() + if tagged, ok := srcRef.DockerReference().(reference.NamedTagged); ok { + dest = dest + ":" + tagged.Tag() + } } destRef, err := istorage.Transport.ParseStoreReference(svc.store, dest) if err != nil {