Fix #8048 : make docker images repository:tag work

Make command like "docker images ubuntu:14.04" work and filter out the
image with the given tag.

Closes #8048.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 4fb88d2e11f2f16c520b36e4c6e00db44ae26b8c
Component: engine
This commit is contained in:
Vincent Demeester
2015-08-08 15:58:48 +02:00
parent b3cd3aa03a
commit d024131050
5 changed files with 99 additions and 4 deletions

View File

@ -18,6 +18,39 @@ func (s *DockerSuite) TestImagesEnsureImageIsListed(c *check.C) {
}
}
func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *check.C) {
_, err := buildImage("imagewithtag:v1",
`FROM scratch
MAINTAINER dockerio1`, true)
c.Assert(err, check.IsNil)
_, err = buildImage("imagewithtag:v2",
`FROM scratch
MAINTAINER dockerio1`, true)
c.Assert(err, check.IsNil)
out, _ := dockerCmd(c, "images", "imagewithtag:v1")
if !strings.Contains(out, "imagewithtag") || !strings.Contains(out, "v1") || strings.Contains(out, "v2") {
c.Fatal("images should've listed imagewithtag:v1 and not imagewithtag:v2")
}
out, _ = dockerCmd(c, "images", "imagewithtag")
if !strings.Contains(out, "imagewithtag") || !strings.Contains(out, "v1") || !strings.Contains(out, "v2") {
c.Fatal("images should've listed imagewithtag:v1 and imagewithtag:v2")
}
}
func (s *DockerSuite) TestImagesEnsureImageWithBadTagIsNotListed(c *check.C) {
out, _ := dockerCmd(c, "images", "busybox:nonexistent")
if strings.Contains(out, "busybox") {
c.Fatal("images should not have listed busybox")
}
}
func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) {
id1, err := buildImage("order:test_a",
`FROM scratch