简体   繁体   English

缺少 docker 容器内进程的 PID

[英]Missing PID for process inside docker container

I'm running a simple web application inside a docker container.我正在 docker 容器中运行一个简单的 Web 应用程序。 When I look at the output of netstat, the PID/Program name is blank.当我查看 netstat 的输出时,PID/程序名称为空。

root@fasf343344423# sudo netstat -tulnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:5697 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:9090 0.0.0.0:* LISTEN -

I've seen the PID before on a different setup.我以前在不同的设置中看到过 PID。 So, I want to understand if this is because of a setup issue.所以,我想了解这是否是因为设置问题。 Appreciate your help感谢你的帮助

I was able to resolve this with the following change:我能够通过以下更改解决此问题:

  1. Edit /etc/apparmor.d/docker file and add the following line编辑/etc/apparmor.d/docker文件并添加以下行

    ptrace peer=docker-default,
  2. sudo service apparmor restart

As in my related question Which PID is using a PORT inside a k8s pod without net tools正如我的相关问题which PID is using a PORT inside a k8s pod without net tools

The lack of POSIX Capability CAP_SYS_PTRACE avoids netstat to trace the inode to PID缺少POSIX Capability CAP_SYS_PTRACE避免了netstat追踪inodePID

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM