aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/inspect.go8
-rw-r--r--cmd/podman/tag.go5
-rw-r--r--docs/podman-tag.1.md14
-rw-r--r--test/e2e/tag_test.go14
4 files changed, 28 insertions, 13 deletions
diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go
index 7820842e8..adb714901 100644
--- a/cmd/podman/inspect.go
+++ b/cmd/podman/inspect.go
@@ -127,7 +127,9 @@ func iterateInput(c *cli.Context, args []string, runtime *libpod.Runtime, inspec
break
}
case inspectTypeImage:
- image, err := runtime.GetImage(input)
+ newImage := runtime.NewImage(input)
+ newImage.GetLocalImageName()
+ image, err := runtime.GetImage(newImage.LocalName)
if err != nil {
inspectError = errors.Wrapf(err, "error getting image %q", input)
break
@@ -140,7 +142,9 @@ func iterateInput(c *cli.Context, args []string, runtime *libpod.Runtime, inspec
case inspectAll:
ctr, err := runtime.LookupContainer(input)
if err != nil {
- image, err := runtime.GetImage(input)
+ newImage := runtime.NewImage(input)
+ newImage.GetLocalImageName()
+ image, err := runtime.GetImage(newImage.LocalName)
if err != nil {
inspectError = errors.Wrapf(err, "error getting image %q", input)
break
diff --git a/cmd/podman/tag.go b/cmd/podman/tag.go
index f29c8c182..b71ee97b8 100644
--- a/cmd/podman/tag.go
+++ b/cmd/podman/tag.go
@@ -30,7 +30,10 @@ func tagCmd(c *cli.Context) error {
}
defer runtime.Shutdown(false)
- img, err := runtime.GetImage(args[0])
+ newImage := runtime.NewImage(args[0])
+ newImage.GetLocalImageName()
+
+ img, err := runtime.GetImage(newImage.LocalName)
if err != nil {
return err
}
diff --git a/docs/podman-tag.1.md b/docs/podman-tag.1.md
index 0728f1997..12afb4b91 100644
--- a/docs/podman-tag.1.md
+++ b/docs/podman-tag.1.md
@@ -6,20 +6,14 @@
podman tag - Add an additional name to a local image
## SYNOPSIS
-**podman tag**
+**podman [GLOBAL OPTIONS] tag IMAGE[:TAG] TARGET_NAME[:TAG]**
[**--help**|**-h**]
## DESCRIPTION
-Assigns a new alias to an image in a registry. An alias refers to the entire image name, including the optional **TAG** after the ':'
+Assigns a new alias to an image. An alias refers to the entire image name, including the optional
+**TAG** after the ':' If you do not provide a :TAG, podman will assume a :TAG of "latest" for both
+the IMAGE and the TARGET_NAME.
-**podman [GLOBAL OPTIONS]**
-
-**podman [GLOBAL OPTIONS] tag [OPTIONS]**
-
-## GLOBAL OPTIONS
-
-**--help, -h**
- Print usage statement
## EXAMPLES
diff --git a/test/e2e/tag_test.go b/test/e2e/tag_test.go
index 7f14c7eb4..5b578ee07 100644
--- a/test/e2e/tag_test.go
+++ b/test/e2e/tag_test.go
@@ -66,4 +66,18 @@ var _ = Describe("Podman tag", func() {
Expect(StringInSlice("docker.io/library/alpine:latest", inspectData[0].RepoTags)).To(BeTrue())
Expect(StringInSlice("foobar:new", inspectData[0].RepoTags)).To(BeTrue())
})
+
+ It("podman tag shortname image no tag", func() {
+ session := podmanTest.Podman([]string{"tag", ALPINE, "foobar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ results := podmanTest.Podman([]string{"tag", "foobar", "barfoo"})
+ results.WaitWithDefaultTimeout()
+ Expect(results.ExitCode()).To(Equal(0))
+
+ verify := podmanTest.Podman([]string{"inspect", "barfoo"})
+ verify.WaitWithDefaultTimeout()
+ Expect(verify.ExitCode()).To(Equal(0))
+ })
})