Skip to content

feat(ps): show container health status in STATUS column#4933

Open
haytok wants to merge 1 commit into
containerd:mainfrom
haytok:ps-show-health-status
Open

feat(ps): show container health status in STATUS column#4933
haytok wants to merge 1 commit into
containerd:mainfrom
haytok:ps-show-health-status

Conversation

@haytok
Copy link
Copy Markdown
Member

@haytok haytok commented May 23, 2026

docker ps displays the health check results for healthchecked containers in the STATUS column:

$ docker run -d --name health --health-cmd=true --health-interval=3s alpine sleep inf
ace14dd125355ac04e8cbad9f1cf2eaaa7209d76cb648ccefb81e45b986c58f7

$ docker ps
CONTAINER ID   IMAGE     COMMAND       CREATED          STATUS                    PORTS     NAMES
ace14dd12535   alpine    "sleep inf"   23 seconds ago   Up 22 seconds (healthy)             health

However, nerdctl ps doesn't show the health status.

Therefore, to ensure compatibility with Docker, this change makes nerdctl ps display the health check results in the STATUS column for containers that perform health checks.

After this change, the output looks like:

$ sudo nerdctl ps
CONTAINER ID    IMAGE                              COMMAND                   CREATED          STATUS                   PORTS    NAMES
02c64243528a    docker.io/library/alpine:latest    "sleep inf"               7 seconds ago    Up (health: starting)             hoge
$ sudo nerdctl ps
CONTAINER ID    IMAGE                              COMMAND                   CREATED         STATUS          PORTS    NAMES
690aa502978c    docker.io/library/alpine:latest    "sleep inf"               1 second ago    Up (healthy)             hoge
$ sudo nerdctl ps
CONTAINER ID    IMAGE                              COMMAND                   CREATED         STATUS            PORTS    NAMES
02c64243528a    docker.io/library/alpine:latest    "sleep inf"               2 hours ago     Up (unhealthy)             hoge

`docker ps` displays the health check results for healthchecked containers
in the STATUS column:

```bash
$ docker run -d --name health --health-cmd=true --health-interval=3s alpine sleep inf
ace14dd125355ac04e8cbad9f1cf2eaaa7209d76cb648ccefb81e45b986c58f7

$ docker ps
CONTAINER ID   IMAGE     COMMAND       CREATED          STATUS                    PORTS     NAMES
ace14dd12535   alpine    "sleep inf"   23 seconds ago   Up 22 seconds (healthy)             health
```

However, `nerdctl ps` doesn't show the health status.

Therefore, to ensure compatibility with Docker, this change makes
`nerdctl ps` display the health check results in the STATUS column for
containers that perform health checks.

After this change, the output looks like:

```bash
$ sudo nerdctl ps
CONTAINER ID    IMAGE                              COMMAND                   CREATED          STATUS                   PORTS    NAMES
02c64243528a    docker.io/library/alpine:latest    "sleep inf"               7 seconds ago    Up (health: starting)             hoge
```

```bash
$ sudo nerdctl ps
CONTAINER ID    IMAGE                              COMMAND                   CREATED         STATUS          PORTS    NAMES
690aa502978c    docker.io/library/alpine:latest    "sleep inf"               1 second ago    Up (healthy)             hoge
```

```bash
$ sudo nerdctl ps
CONTAINER ID    IMAGE                              COMMAND                   CREATED         STATUS            PORTS    NAMES
02c64243528a    docker.io/library/alpine:latest    "sleep inf"               2 hours ago     Up (unhealthy)             hoge
```

Signed-off-by: Hayato Kiwata <dev@haytok.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant