Is it possible for ps to show container name

37 views Asked by At

Is there a way to tell ps (the bash command, not docker ps) to show the name of container that a specific process is running in?

So lets say I did this:

systemctl start nginx
lxc launch some-nginx-image firstcontainer
docker run some-nginx-image --name=secondcontainer

How can I get ps to show me:

$ ps aux | grep nginx

host             www-data 10001  0.0  0.0 219584  7864 ?        S    10:36   0:00 nginx
firstcontainer   www-data 10002  0.0  0.0 219584  7864 ?        S    10:36   0:00 nginx
secondcontainer  www-data 10003  0.0  0.0 219584  7864 ?        S    10:36   0:00 nginx

The container does not have to be first column, all I need is for it to be included in the list of columns.

0

There are 0 answers