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
+4
View File
@@ -41,6 +41,10 @@ func (daemon *Daemon) DeleteImage(eng *engine.Engine, name string, imgs *engine.
tag = graph.DEFAULTTAG
}
if name == "" {
return fmt.Errorf("Image name can not be blank")
}
img, err := daemon.Repositories().LookupImage(name)
if err != nil {
if r, _ := daemon.Repositories().Get(repoName); r != nil {