This post was updated 968 days ago and some of the ideas may be out of date.
问题描述
今天在 docker
中部署完 nginx
后,想看下是否已经启动成功,于是想通过 ps
命令查看进程:
Source code 1 lineps -ef|grep 'nginx'
结果报了如下错误:
Source code 2 linesroot@extand-6b8689c85-zwggj:/<em># ps -ef|grep 'nginx'</em>bash: ps: command not found
解决方法
出现 bash: ps: command not found
错误的原因是,由于该 nginx 镜像
没有打包 ps 命令
,我们可以使用如下命令安装:
Source code 1 lineapt-get update && apt-get install procps
稍等片刻安装成功后,再执行 ps
命令,已不再报错,具体如下:
Source code 4 linesroot@extand-6b8689c85-zwggj:/<em># ps -ef|grep 'nginx'</em>root 1 0 0 01:45 ? 00:00:00 nginx: master process nginx -g daemon off;nginx 31 1 0 01:45 ? 00:00:00 nginx: worker processroot 411 87 0 05:59 pts/3 00:00:00 grep nginx
参与讨论