user4725754
user4725754

Reputation:

Container process on host machine

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.

enter image description here

How can I identify, that this command is running inside a container instead of host?

Upvotes: 5

Views: 2374

Answers (3)

D-rk
D-rk

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.

Docker Exec Reference

Upvotes: 0

VonC
VonC

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

Mitch
Mitch

Reputation: 22251

You should be able to add the cgroup column which identifies the container the process is running under.

  • Press F2
  • Setup
  • Columns
  • Choose CGROUP
  • Press F10 to save

Upvotes: 2

Related Questions