summaryrefslogtreecommitdiff
path: root/cmd/podman
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 /cmd/podman
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 'cmd/podman')
-rw-r--r--cmd/podman/save.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/cmd/podman/save.go b/cmd/podman/save.go
index 2f9adc843..016fa580a 100644
--- a/cmd/podman/save.go
+++ b/cmd/podman/save.go
@@ -1,6 +1,7 @@
package main
import (
+ "fmt"
"io"
"os"
"strings"
@@ -118,14 +119,26 @@ func saveCmd(c *cli.Context) error {
return err
}
}
- newImage, err := runtime.ImageRuntime().NewFromLocal(args[0])
+ source := args[0]
+ newImage, err := runtime.ImageRuntime().NewFromLocal(source)
if err != nil {
return err
}
dest := dst
// need dest to be in the format transport:path:reference for the following transports
- if (strings.Contains(dst, libpod.OCIArchive) || strings.Contains(dst, libpod.DockerArchive)) && !strings.Contains(newImage.ID(), args[0]) {
- dest = dst + ":" + args[0]
+ if (strings.Contains(dst, libpod.OCIArchive) || strings.Contains(dst, libpod.DockerArchive)) && !strings.Contains(newImage.ID(), source) {
+ prepend := ""
+ if !strings.Contains(source, libpodImage.DefaultLocalRepo) {
+ // we need to check if localhost was added to the image name in NewFromLocal
+ for _, name := range newImage.Names() {
+ // if the user searched for the image whose tag was prepended with localhost, we'll need to prepend localhost to successfully search
+ if strings.Contains(name, libpodImage.DefaultLocalRepo) && strings.Contains(name, source) {
+ prepend = fmt.Sprintf("%s/", libpodImage.DefaultLocalRepo)
+ break
+ }
+ }
+ }
+ dest = fmt.Sprintf("%s:%s%s", dst, prepend, source)
}
if err := newImage.PushImage(getContext(), dest, manifestType, "", "", writer, c.Bool("compress"), libpodImage.SigningOptions{}, &libpodImage.DockerRegistryOptions{}, false, additionaltags); err != nil {
if err2 := os.Remove(output); err2 != nil {