How to register all processes running inside a Docker container?

After entering the container using the -

docker exec -it <container_name> 

How to check all processed operations inside the container? Is this "ps aux" right? Are there any better alternative approaches?

thanks

+5
source share
2 answers

You can show all processes running inside the container without entering the terminal using the following command. Of course, this is similar to what you can see with ps -eaf , so just add it to docker exec .

 bash $ sudo docker exec -it test1 ps -eaf PID USER TIME COMMAND 1 root 0:00 sh 7 root 0:00 sh 60 root 0:00 /bin/sh 67 root 0:00 /bin/sh 84 root 0:00 ps -eaf 

As already mentioned, if you are already inside the container, just use the ps -eaf to see the running processes.

By the way, it is recommended to have one application / process for each container.

+6
source

You can use the dedicated top command to view the process in the docker container, regardless of the operating system in the container.

 docker top <container> 
+7
source

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


All Articles