summaryrefslogtreecommitdiff
path: root/libpod/image/pull.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-07-20 12:50:18 -0400
committerGitHub <noreply@github.com>2018-07-20 12:50:18 -0400
commit6cae4a0e94cf2ee66687ee0cbf553270396c2d5c (patch)
treea383b1728be7a00732a16ba7e3a504e5ebce3766 /libpod/image/pull.go
parent7944bca4681893971ad6bda4ade4e1b3470b9559 (diff)
parent0fecfeee6398e2db6b7b3fd257645a6ea9aab542 (diff)
downloadpodman-6cae4a0e94cf2ee66687ee0cbf553270396c2d5c.tar.gz
podman-6cae4a0e94cf2ee66687ee0cbf553270396c2d5c.tar.bz2
podman-6cae4a0e94cf2ee66687ee0cbf553270396c2d5c.zip
Merge pull request #1103 from haircommander/load_dockerless
Podman load/tag/save prepends localhost when no registry is present
Diffstat (limited to 'libpod/image/pull.go')
-rw-r--r--libpod/image/pull.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index f12c1ae5f..3bfbc912c 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -45,6 +45,9 @@ var (
AtomicTransport = "atomic"
// DefaultTransport is a prefix that we apply to an image name
DefaultTransport = DockerTransport
+ // DefaultLocalRepo is the default local repository for local image operations
+ // Remote pulls will still use defined registries
+ DefaultLocalRepo = "localhost"
)
type pullStruct struct {
@@ -55,6 +58,14 @@ type pullStruct struct {
}
func (ir *Runtime) getPullStruct(srcRef types.ImageReference, destName string) (*pullStruct, error) {
+ imgPart, err := decompose(destName)
+ if err == nil && !imgPart.hasRegistry {
+ // If the image doesn't have a registry, set it as the default repo
+ imgPart.registry = DefaultLocalRepo
+ imgPart.hasRegistry = true
+ destName = imgPart.assemble()
+ }
+
reference := destName
if srcRef.DockerReference() != nil {
reference = srcRef.DockerReference().String()
@@ -148,7 +159,9 @@ func (ir *Runtime) getPullListFromRef(ctx context.Context, srcRef types.ImageRef
image := splitArr[1]
// remove leading "/"
if image[:1] == "/" {
- image = image[1:]
+ // Instead of removing the leading /, set localhost as the registry
+ // so docker.io isn't prepended, and the path becomes the repository
+ image = DefaultLocalRepo + image
}
pullInfo, err := ir.getPullStruct(srcRef, image)
if err != nil {