From d3de206cf9feed8f1d6b5775c427fe495dadbea2 Mon Sep 17 00:00:00 2001 From: Shishir Mahajan Date: Mon, 5 Oct 2015 14:39:31 -0400 Subject: [PATCH] Make docker tag error message more user friendly Signed-off-by: Shishir Mahajan Upstream-commit: 582a24e937d1e0746b91a13bacd7f5fd65a38741 Component: engine --- components/engine/graph/tags.go | 2 +- components/engine/integration-cli/docker_cli_tag_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/engine/graph/tags.go b/components/engine/graph/tags.go index 804898c1d3..97737f4b9c 100644 --- a/components/engine/graph/tags.go +++ b/components/engine/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 !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 { diff --git a/components/engine/integration-cli/docker_cli_tag_test.go b/components/engine/integration-cli/docker_cli_tag_test.go index 45754ee775..d1aa6fdbed 100644 --- a/components/engine/integration-cli/docker_cli_tag_test.go +++ b/components/engine/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") 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") } }