Better error message for "docker rmi ''"

See: https://github.com/docker/docker/issues/10867

While looking at #10867 I noticed that the error message generated for
a blank image ID wasn't very helpful so this fixes that.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: eeb36c9348b7af339638936a98d66ee4f9be62ee
Component: engine
This commit is contained in:
Doug Davis
2015-03-04 13:21:59 -08:00
parent 5a0621576b
commit f888d145c2
2 changed files with 18 additions and 0 deletions
@@ -155,5 +155,19 @@ func TestRmiWithMultipleRepositories(t *testing.T) {
}
logDone("rmi - delete a image which its dependency tagged to multiple repositories success")
}
func TestRmiBlank(t *testing.T) {
// try to delete a blank image name
runCmd := exec.Command(dockerBinary, "rmi", "")
out, _, err := runCommandWithOutput(runCmd)
if err == nil {
t.Fatal("Should have failed to delete '' image")
}
if strings.Contains(out, "No such image") {
t.Fatalf("Wrong error message generated: %s", out)
}
logDone("rmi- blank image name")
}