ps命令在docker容器不存在

问题描述:

$ docker exec -it c0 bash
root@c0994264e9b8:/# which nginx
/usr/sbin/nginx
root@c0994264e9b8:/# ps -ef
bash: ps: command not found

解决方案:

问题是该nginx镜像没有打包ps命令

使用如下命令安装

apt-get update && apt-get install procps

root@c0994264e9b8:/# apt-get update && apt-get install procps
安装...
root@c0994264e9b8:/# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 06:30 ?        00:00:00 nginx: master process nginx -g daemon off;
nginx        7     1  0 06:30 ?        00:00:00 nginx: worker process
root       349     0  0 08:25 pts/0    00:00:00 bash
root       594   349  0 08:26 pts/0    00:00:00 ps -ef

猜你喜欢

转载自blog.csdn.net/pansanday/article/details/81432485