aboutsummaryrefslogtreecommitdiff
path: root/libpod/image/image.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/image/image.go')
-rw-r--r--libpod/image/image.go28
1 files changed, 12 insertions, 16 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go
index 301954703..cecd64eb7 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -24,6 +24,7 @@ import (
"github.com/containers/image/v5/manifest"
ociarchive "github.com/containers/image/v5/oci/archive"
"github.com/containers/image/v5/oci/layout"
+ "github.com/containers/image/v5/pkg/shortnames"
is "github.com/containers/image/v5/storage"
"github.com/containers/image/v5/tarball"
"github.com/containers/image/v5/transports"
@@ -164,7 +165,7 @@ func (ir *Runtime) New(ctx context.Context, name, signaturePolicyPath, authfile
}
imageName, err := ir.pullImageFromHeuristicSource(ctx, name, writer, authfile, signaturePolicyPath, signingoptions, dockeroptions, &retry.RetryOptions{MaxRetry: maxRetry}, label)
if err != nil {
- return nil, errors.Wrapf(err, "unable to pull %s", name)
+ return nil, err
}
newImage, err := ir.NewFromLocal(imageName[0])
@@ -318,10 +319,8 @@ func (ir *Runtime) LoadAllImagesFromDockerArchive(ctx context.Context, fileName
}
goal := pullGoal{
- pullAllPairs: true,
- usedSearchRegistries: false,
- refPairs: refPairs,
- searchedRegistries: nil,
+ pullAllPairs: true,
+ refPairs: refPairs,
}
defer goal.cleanUp()
@@ -456,22 +455,19 @@ func (ir *Runtime) getLocalImage(inputName string) (string, *storage.Image, erro
return "", nil, errors.Wrapf(ErrNoSuchImage, imageError)
}
- // "Short-name image", so let's try out certain prefixes:
- // 1) DefaultLocalRegistry (i.e., "localhost/)
- // 2) Unqualified-search registries from registries.conf
- unqualifiedSearchRegistries, err := registries.GetRegistries()
+ sys := &types.SystemContext{
+ SystemRegistriesConfPath: registries.SystemRegistriesConfPath(),
+ }
+
+ candidates, err := shortnames.ResolveLocally(sys, inputName)
if err != nil {
return "", nil, err
}
- for _, candidate := range append([]string{DefaultLocalRegistry}, unqualifiedSearchRegistries...) {
- ref, err := decomposedImage.referenceWithRegistry(candidate)
- if err != nil {
- return "", nil, err
- }
- img, err := ir.store.Image(reference.TagNameOnly(ref).String())
+ for _, candidate := range candidates {
+ img, err := ir.store.Image(candidate.String())
if err == nil {
- return ref.String(), img, nil
+ return candidate.String(), img, nil
}
}