查看docker容器内的pid和宿主机中pid的映射关系

注:Linux内核版本小于4.1用此方法
进入对应的容器,执行

grep threads /proc/*/sched

从返回信息中可以看到容器内进程号和宿主机中进程号的对应关系,示例如下

root@55e0b2020fc0:/# grep threads /proc/*/sched
/proc/1/sched:nginx (14773, #threads: 1)
/proc/24/sched:nginx (14819, #threads: 1)
/proc/25/sched:nginx (14820, #threads: 1)
/proc/26/sched:nginx (14821, #threads: 1)
/proc/27/sched:nginx (14822, #threads: 1)
/proc/35/sched:bash (15629, #threads: 1)
/proc/self/sched:grep (18469, #threads: 1)

参考:

查看docker容器中的pid和宿主host中的pid映射对应关系

你可能感兴趣的:(#,python后端开发,docker)