Browse Source

Merge pull request #16776 from shishir-a412ed/docker_tag_error_msg

Make docker tag error message more user friendly
Antonio Murdaca 9 years ago
parent
commit
aac5c44c10
2 changed files with 2 additions and 2 deletions
  1. 1 1
      graph/tags.go
  2. 1 1
      integration-cli/docker_cli_tag_test.go

+ 1 - 1
graph/tags.go

@@ -301,7 +301,7 @@ func (store *TagStore) setLoad(repoName, tag, imageName string, force bool, out
 		if old, exists := store.Repositories[repoName][tag]; exists {
 		if old, exists := store.Repositories[repoName][tag]; exists {
 
 
 			if !force {
 			if !force {
-				return fmt.Errorf("Conflict: Tag %s is already set to image %s, if you want to replace it, please use -f option", tag, old)
+				return fmt.Errorf("Conflict: Tag %s:%s is already set to image %s, if you want to replace it, please use -f option", repoName, tag, old[:12])
 			}
 			}
 
 
 			if old != img.ID && out != nil {
 			if old != img.ID && out != nil {

+ 1 - 1
integration-cli/docker_cli_tag_test.go

@@ -80,7 +80,7 @@ func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) {
 
 
 	dockerCmd(c, "tag", "busybox:latest", "busybox:test")
 	dockerCmd(c, "tag", "busybox:latest", "busybox:test")
 	out, _, err := dockerCmdWithError("tag", "busybox:latest", "busybox:test")
 	out, _, err := dockerCmdWithError("tag", "busybox:latest", "busybox:test")
-	if err == nil || !strings.Contains(out, "Conflict: Tag test is already set to image") {
+	if err == nil || !strings.Contains(out, "Conflict: Tag busybox:test is already set to image") {
 		c.Fatal("tag busybox busybox:test should have failed,because busybox:test is existed")
 		c.Fatal("tag busybox busybox:test should have failed,because busybox:test is existed")
 	}
 	}
 }
 }