From 7dced311d1119d98dbdd60f6d47fdde5abbff7d7 Mon Sep 17 00:00:00 2001 From: umohnani8 Date: Wed, 16 May 2018 11:41:08 -0400 Subject: Allow push/save without image reference If the user uses the image ID when saving to either docker-archive or oci-archive, then do not save a reference in the manifest/index.json. If the user chooses to push without an image reference, i.e : it should be valid and succeed. Signed-off-by: umohnani8 Closes: #782 Approved by: rhatdan --- cmd/podman/save.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd/podman/save.go') diff --git a/cmd/podman/save.go b/cmd/podman/save.go index c3e87f145..32ac37f89 100644 --- a/cmd/podman/save.go +++ b/cmd/podman/save.go @@ -112,15 +112,15 @@ func saveCmd(c *cli.Context) error { // only one image is supported for now // future pull requests will fix this for _, image := range args { - 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) { - dest = dst + ":" + image - } newImage, err := runtime.ImageRuntime().NewFromLocal(image) 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(), image) { + dest = dst + ":" + image + } if err := newImage.PushImage(getContext(), dest, manifestType, "", "", writer, c.Bool("compress"), libpodImage.SigningOptions{}, &libpodImage.DockerRegistryOptions{}, false); err != nil { if err2 := os.Remove(output); err2 != nil { logrus.Errorf("error deleting %q: %v", output, err) -- cgit v1.2.3-54-g00ecf