欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ps命令在docker容器不存在

程序员文章站 2022-05-11 15:39:10
...

问题描述:

$ docker exec -it c0 bash
[email protected]:/# which nginx
/usr/sbin/nginx
[email protected]:/# ps -ef
bash: ps: command not found

解决方案:

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

使用如下命令安装

apt-get update && apt-get install procps

[email protected]:/# apt-get update && apt-get install procps
安装...
[email protected]:/# 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