Description
In rootful mode, port mappings will spawn a sleep infinity process on the host to reserve the ports.
When the container stops, the iptables rules are cleaned up as expected. However, the reserved process remains and continues to stay in the LISTEN state.
This behavior can be confusing in some scenarios, as the port appears to still be in use even though the container has already exited.
Related change in v2.1.6:
rootful: reserve the ports on the host (#4526 )
Steps to reproduce the issue
- In rootful mode, root user
nerdctl run -d -p 7000:7000 -name test-container test-image
nerdctl stop test-container
ss -ntlp | grep ":7000" (or netstat -ntlp )
Describe the results you received and expected
Received:
After the container stops, ss -ntlp still shows a sleep infinity process in the LISTEN state.
Expected:
Would it be possible to add cleanup logic for this process when the container stops?
Furthermore, is it possible to support a configuration similar to Docker:
# /etc/docker/daemon.json
{
"userland-proxy": false
}
What version of nerdctl are you using?
v2.1.6
Are you using a variant of nerdctl? (e.g., Rancher Desktop)
None
Host information
nerdctl-full-2.1.6-linux-amd64.tar.gz
Description
In rootful mode, port mappings will spawn a
sleep infinityprocess on the host to reserve the ports.When the container stops, the iptables rules are cleaned up as expected. However, the reserved process remains and continues to stay in the LISTEN state.
This behavior can be confusing in some scenarios, as the port appears to still be in use even though the container has already exited.
Related change in v2.1.6:
rootful: reserve the ports on the host (#4526 )
Steps to reproduce the issue
nerdctl run -d -p 7000:7000 -name test-container test-imagenerdctl stop test-containerss -ntlp | grep ":7000"(ornetstat -ntlp)Describe the results you received and expected
Received:
After the container stops,
ss -ntlpstill shows asleep infinityprocess in the LISTEN state.Expected:
Would it be possible to add cleanup logic for this process when the container stops?
Furthermore, is it possible to support a configuration similar to Docker:
What version of nerdctl are you using?
v2.1.6
Are you using a variant of nerdctl? (e.g., Rancher Desktop)
None
Host information
nerdctl-full-2.1.6-linux-amd64.tar.gz