I've run into a problem on one of my containers built using alpine 3.3.
When I run the following command:
ps
Sample output:
PID USER TIME COMMAND
1 root 0:00 /bin/bash /entrypoint.sh
20 nginx 0:00 php-fpm: pool www
and then proceed to run the following command:
ps -A -o pid,command | grep [f]pm
I get the following error:
ps: bad -o argument 'command', supported arguments: user,group,comm,args,pid,ppid,pgid,etime,nice,rgroup,ruser,time,tty,vsz,stat,rss
I understand what the error means and how to solve my problem, but I want to understand why it doesn't work. I've carried out the same steps on a VM based on CentOS 7 and it does work.
Is it simply down to different implementations of "ps" or is there something more to it?
Thanks,
The default ps in the image is a BusyBox command. You need to install procps to get the ps you are expecting:
apk --no-cache add procps
make
Most helpful comment
The default
psin the image is a BusyBox command. You need to installprocpsto get thepsyou are expecting: