mirror of
https://github.com/docker/docs.git
synced 2026-04-12 06:19:22 +07:00
Merge pull request #15780 from mountkin/build-multi-tags
Add ability to add multiple tags with docker build
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user