Skip to content

fix: suppress warning message on a stopped container in nerdctl conta…#4967

Open
haytok wants to merge 1 commit into
containerd:mainfrom
haytok:suppress-netns-warning-on-stopped-container
Open

fix: suppress warning message on a stopped container in nerdctl conta…#4967
haytok wants to merge 1 commit into
containerd:mainfrom
haytok:suppress-netns-warning-on-stopped-container

Conversation

@haytok

@haytok haytok commented Jun 15, 2026

Copy link
Copy Markdown
Member

…iner inspect

Currently, when running nerdctl container inspect on a stopped container, the following warning message is shown:

> sudo nerdctl ps -a --filter=name=nginx
CONTAINER ID    IMAGE                             COMMAND                   CREATED         STATUS                      PORTS    NAMES
4ce4cb9b1ed1    docker.io/library/nginx:latest    "/docker-entrypoint.…"    14 hours ago    Exited (0) 8 seconds ago             nginx

> sudo nerdctl container inspect nginx
WARN[0000] failed to inspect NetNS                       error="failed to Statfs \"/proc/1548927/ns/net\": no such file or directory" id=4ce4cb9b1ed12f65b02e0f4af8a753d0e9ad1d42d5b77dac206c396021d90ab0
...

This warning occurs because /proc/<PID>/ns/net is referenced using a stale PID, but the process for a stopped container has already been released.

/proc/<PID>/ns/net should not be referenced when the container is stopped.

Therefore, this commit suppresses the warning message above when running nerdctl container inspect on a stopped container.

…iner inspect

Currently, when running `nerdctl container inspect` on a stopped
container, the following warning message is shown:

```bash
> sudo nerdctl ps -a --filter=name=nginx
CONTAINER ID    IMAGE                             COMMAND                   CREATED         STATUS                      PORTS    NAMES
4ce4cb9b1ed1    docker.io/library/nginx:latest    "/docker-entrypoint.…"    14 hours ago    Exited (0) 8 seconds ago             nginx

> sudo nerdctl container inspect nginx
WARN[0000] failed to inspect NetNS                       error="failed to Statfs \"/proc/1548927/ns/net\": no such file or directory" id=4ce4cb9b1ed12f65b02e0f4af8a753d0e9ad1d42d5b77dac206c396021d90ab0
...
```

This warning occurs because `/proc/<PID>/ns/net` is referenced using a
stale PID, but the process for a stopped container has already been
released.

`/proc/<PID>/ns/net` should not be referenced when the container is
stopped.

Therefore, this commit suppresses the warning message above when running
`nerdctl container inspect` on a stopped container.

Signed-off-by: Hayato Kiwata <dev@haytok.jp>
@AkihiroSuda AkihiroSuda added this to the v2.3.2 milestone Jun 15, 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

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