Reputation:
I'm using Docker and would like to identify which processes are running on containers. So, I run this command on my container, which will uses nearly 100 % CPU.
md5sum /dev/urandom
After that I've checked processes using htop
on host machine.
How can I identify, that this command is running inside a container instead of host?
Upvotes: 5
Views: 2374
Reputation: 5919
Another option would be to run a command on the container:
docker exec <container> ps ax
This should list the processes running in the container.
Upvotes: 0
Reputation: 1323343
As mentioned in "Docker Processes Shown on Host Process List", you can also run top
then press shift+f and select the nsPID
and nsUSER
The nsPID should match docker inspect --format='{{ .State.Pid }}' <acontainer>
(as in this example, inspired by the pipework script)
Upvotes: 0
Reputation: 22251
You should be able to add the cgroup
column which identifies the container the process is running under.
CGROUP
Upvotes: 2