fix the panic when "ps -a" with dead containers

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
This commit is contained in:
Shijiang Wei 2015-11-30 21:28:21 +08:00
parent d05c80c1ae
commit 3f6182c384
1 changed files with 5 additions and 1 deletions

View File

@ -282,9 +282,13 @@ func getContainersJSON(c *context, w http.ResponseWriter, r *http.Request) {
}
// Apply filters.
if len(container.Names) > 0 {
if !filters.Match("name", strings.TrimPrefix(container.Names[0], "/")) {
continue
}
} else if len(filters["name"]) > 0 {
continue
}
if !filters.Match("id", container.Id) {
continue
}