From f109e1a662ade4b46618bbc68fc3dca85a436358 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 26 May 2021 16:33:06 +0200 Subject: [PATCH 1/3] pull: don't resolve short names on explicit docker:// reference Fixes: #581 Signed-off-by: Valentin Rothberg --- libimage/pull.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libimage/pull.go b/libimage/pull.go index d93715279..dc429f727 100644 --- a/libimage/pull.go +++ b/libimage/pull.go @@ -52,6 +52,7 @@ func (r *Runtime) Pull(ctx context.Context, name string, pullPolicy config.PullP options = &PullOptions{} } + var possiblyUnqualifiedName string // used for short-name resolution ref, err := alltransports.ParseImageName(name) if err != nil { // If the image clearly refers to a local one, we can look it up directly. @@ -74,6 +75,17 @@ func (r *Runtime) Pull(ctx context.Context, name string, pullPolicy config.PullP return nil, err } ref = dockerRef + possiblyUnqualifiedName = name + } else if ref.Transport().Name() == registryTransport.Transport.Name() { + // Normalize the input if we're referring to the docker + // transport directly. That makes sure that a `docker://fedora` + // will resolve directly to `docker.io/library/fedora:latest` + // and not be subject to short-name resolution. + named := ref.DockerReference() + if named == nil { + return nil, errors.New("internal error: unexpected nil reference") + } + possiblyUnqualifiedName = named.String() } if options.AllTags && ref.Transport().Name() != registryTransport.Transport.Name() { @@ -94,7 +106,7 @@ func (r *Runtime) Pull(ctx context.Context, name string, pullPolicy config.PullP // DOCKER REGISTRY case registryTransport.Transport.Name(): - pulledImages, pullError = r.copyFromRegistry(ctx, ref, strings.TrimPrefix(name, "docker://"), pullPolicy, options) + pulledImages, pullError = r.copyFromRegistry(ctx, ref, possiblyUnqualifiedName, pullPolicy, options) // DOCKER ARCHIVE case dockerArchiveTransport.Transport.Name(): From bff4b3e3d0a74aff34cd03da5f9cea3ca8d5b386 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 26 May 2021 17:58:23 +0200 Subject: [PATCH 2/3] v0.38.5 * pull: don't resolve short names on explicit docker:// reference Signed-off-by: Valentin Rothberg --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index f6f6d1608..c9e080c8d 100644 --- a/version/version.go +++ b/version/version.go @@ -1,4 +1,4 @@ package version // Version is the version of the build. -const Version = "0.38.4" +const Version = "0.38.5" From c13df75a64134c63dfe5a90f6e4bca733c4b1171 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 26 May 2021 17:59:15 +0200 Subject: [PATCH 3/3] bump to v0.38.6-dev Signed-off-by: Valentin Rothberg --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index c9e080c8d..e15bd6aea 100644 --- a/version/version.go +++ b/version/version.go @@ -1,4 +1,4 @@ package version // Version is the version of the build. -const Version = "0.38.5" +const Version = "0.38.6-dev"