The container process on the host machine

I am using Docker and want to determine which processes are running on containers. So, I ran this command in my container, which will use almost 100% of the CPU.

md5sum /dev/urandom

After that, I checked the processes using htopthe main machine.

enter image description here

How can I tell if this command is running inside the container instead of the host?

+4
source share
3 answers

As mentioned in the Docker Processes section shown in the host process list , you can also start top, then press shift+ fand select nsPIDandnsUSER

nsPID docker inspect --format='{{ .State.Pid }}' <acontainer>
( , pipework script)

0

cgroup, , .

  • F2
  • cgroup
  • F10,
+2

Another option is to run the command in the container:

docker exec <container> ps ax

This list should list the processes running in the container.

Docker Exec Reference

0
source

Source: https://habr.com/ru/post/1612630/


All Articles