summaryrefslogtreecommitdiff
path: root/libpod/image/pull.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/image/pull.go')
-rw-r--r--libpod/image/pull.go28
1 files changed, 27 insertions, 1 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index cd915cb47..48513509d 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -225,7 +225,23 @@ func (i *Image) pullImage(ctx context.Context, writer io.Writer, authfile, signa
images = append(images, imageInfo.image)
}
}
- return images, errors.Wrapf(err, "error pulling image from")
+ // If no image was found, we should handle. Lets be nicer to the user and see if we can figure out why.
+ if len(images) == 0 {
+ registryPath := sysregistries.RegistriesConfPath(&types.SystemContext{})
+ searchRegistries, err := registries.GetRegistries()
+ if err != nil {
+ return nil, err
+ }
+ hasRegistryInName, err := i.hasRegistry()
+ if err != nil {
+ return nil, err
+ }
+ if !hasRegistryInName && len(searchRegistries) == 0 {
+ return nil, errors.Errorf("image name provided is a short name and no search registries are defined in %s.", registryPath)
+ }
+ return nil, errors.Errorf("unable to find image in the registries defined in %q", registryPath)
+ }
+ return images, nil
}
// createNamesToPull looks at a decomposed image and determines the possible
@@ -281,3 +297,13 @@ func (i *Image) createNamesToPull() ([]*pullStruct, error) {
return pullNames, nil
}
+
+// isShortName returns a bool response if the input image name has a registry
+// name in it or not
+func (i *Image) isShortName() (bool, error) {
+ decomposedImage, err := decompose(i.InputName)
+ if err != nil {
+ return false, err
+ }
+ return decomposedImage.hasRegistry, nil
+}