feat(ps): show container health status in STATUS column#4933
Open
haytok wants to merge 1 commit into
Open
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docker psdisplays 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) healthHowever,
nerdctl psdoesn't show the health status.Therefore, to ensure compatibility with Docker, this change makes
nerdctl psdisplay 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