Skip to content

fix(top): handle stopped and paused containers correctly - #5223

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
immanuwell:fix/top-container-states
Sep 20, 2026
Merged

AkihiroSuda merged 1 commit into
containerd:mainfrom
immanuwell:fix/top-container-states

Conversation

@immanuwell

@immanuwell immanuwell commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

nerdctl top silently exits 0 with no output for stopped and paused containers

Repro:

id=$(nerdctl run -d alpine sleep 300)
nerdctl stop "$id"
nerdctl top "$id"
echo $?

Before this prints nothing and exits 0. Pausing a running container has the same empty output

This returns is not running for stopped tasks and lets paused tasks reach the existing PID lookup.
Running containers stay unchanged.
Tests cover both cases with nerdctl and Docker

Return an error for stopped tasks while allowing paused tasks to proceed to PID inspection.

Signed-off-by: Immanuel Tikhonov <pchpr.00@list.ru>
@AkihiroSuda AkihiroSuda added this to the v2.4.0 milestone Sep 19, 2026

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda
AkihiroSuda merged commit 08ed575 into containerd:main Sep 20, 2026
53 of 56 checks passed
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.

2 participants