Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

docker compose ps does not list stopped containers and their exit status #1671

@petr-ujezdsky

Description

@petr-ujezdsky

Description
I have found that there are some differences between docker-compose ps and docker-compose ps regarding to stopped containers (when you docker compose stop some-service1):

Here it is listed (old version)

$ docker-compose ps
              Name                            Command                  State                                 Ports
--------------------------------------------------------------------------------------------------------------------------------------------
...
some-service1                      /usr/sbin/entrypoint.sh /t ...   Exit 137
some-service2                      /usr/sbin/entrypoint.sh /t ...   Exit 0

Here it is not listed (new version)

$ docker compose ps
NAME                               SERVICE                 STATUS              PORTS
...

You can force it using the -a parameter, but I am not sure if there won't be any other containers listed in other scenarios (eg. run command).
Note that also both containers are flagged as unhealthy even though the second one ended gracefully (Exit 0).

$ docker compose ps -a
NAME                               SERVICE                 STATUS               PORTS
some-service1                      some-service1           exited (unhealthy)
some-service2                      some-service2           exited (unhealthy)
$ docker compose ps --help

Usage:  docker compose ps

List containers

Options:
  -a, --all             Show all stopped containers (including those created by the run command)
      --format string   Format the output. Values: [pretty | json]. (default "pretty")
  -q, --quiet           Only display IDs
      --services        Display services

Steps to reproduce the issue:

  1. run commands listed above

Describe the results you received:
Different output in newer version

Describe the results you expected:
Same output as in older version

Output of docker version:
I am using docker-for-mac:

$ docker version
Client:
 Cloud integration: 1.0.14
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.16.3
 Git commit:        370c289
 Built:             Fri Apr  9 22:46:57 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd2
  Built:            Fri Apr  9 22:44:56 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0```

Metadata

Metadata

Assignees

Labels

compatibilityCompatibility with docker-compose

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions