Merge pull request #15780 from mountkin/build-multi-tags

Add ability to add multiple tags with docker build
This commit is contained in:
Sebastiaan van Stijn
2015-10-23 13:50:35 -07:00
10 changed files with 119 additions and 40 deletions

View File

@@ -6258,3 +6258,22 @@ func (s *DockerSuite) TestBuildTagEvent(c *check.C) {
c.Fatal("The 'tag' event not heard from the server")
}
}
// #15780
func (s *DockerSuite) TestBuildMultipleTags(c *check.C) {
dockerfile := `
FROM busybox
MAINTAINER test-15780
`
cmd := exec.Command(dockerBinary, "build", "-t", "tag1", "-t", "tag2:v2",
"-t", "tag1:latest", "-t", "tag1", "--no-cache", "-")
cmd.Stdin = strings.NewReader(dockerfile)
_, err := runCommand(cmd)
c.Assert(err, check.IsNil)
id1, err := getIDByName("tag1")
c.Assert(err, check.IsNil)
id2, err := getIDByName("tag2:v2")
c.Assert(err, check.IsNil)
c.Assert(id1, check.Equals, id2)
}

View File

@@ -1163,7 +1163,6 @@ func buildImageCmd(name, dockerfile string, useCache bool, buildFlags ...string)
buildCmd := exec.Command(dockerBinary, args...)
buildCmd.Stdin = strings.NewReader(dockerfile)
return buildCmd
}
func buildImageWithOut(name, dockerfile string, useCache bool, buildFlags ...string) (string, string, error) {