From 2639e073b19f526ceecbede9439aed0aba0a4ad8 Mon Sep 17 00:00:00 2001 From: Jessica Frazelle Date: Thu, 8 Jan 2015 15:14:04 -0800 Subject: [PATCH] `docker ps --filter status=exited should not require passing -a` Docker-DCO-1.1-Signed-off-by: Jessica Frazelle (github: jfrazelle) --- daemon/list.go | 8 ++++++++ integration-cli/docker_cli_ps_test.go | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/daemon/list.go b/daemon/list.go index 937cdd2123..0f3a88e902 100644 --- a/daemon/list.go +++ b/daemon/list.go @@ -45,6 +45,14 @@ func (daemon *Daemon) Containers(job *engine.Job) engine.Status { } } + if i, ok := psFilters["status"]; ok { + for _, value := range i { + if value == "exited" { + all = true + } + } + } + names := map[string][]string{} daemon.ContainerGraph().Walk("/", func(p string, e *graphdb.Entity) error { names[e.ID()] = append(names[e.ID()], p) diff --git a/integration-cli/docker_cli_ps_test.go b/integration-cli/docker_cli_ps_test.go index 09207826bb..17a7280b0a 100644 --- a/integration-cli/docker_cli_ps_test.go +++ b/integration-cli/docker_cli_ps_test.go @@ -312,7 +312,7 @@ func TestPsListContainersFilterStatus(t *testing.T) { secondID := stripTrailingCharacters(out) // filter containers by exited - runCmd = exec.Command(dockerBinary, "ps", "-a", "-q", "--filter=status=exited") + runCmd = exec.Command(dockerBinary, "ps", "-q", "--filter=status=exited") out, _, err = runCommandWithOutput(runCmd) if err != nil { t.Fatal(out, err)