Docker top Command
docker top : Display the running processes in a container, supporting ps command options.
Syntax
docker top [OPTIONS] CONTAINER [ps OPTIONS]
When a container is running, it may not have a /bin/bash terminal for interactive execution of the top command, and the container may not even have the top command. You can use docker top to view the processes running in the container.
Example
View the process information of the container mymysql.
tutorialpro@tutorialpro:~/mysql$ docker top mymysql
UID PID PPID C STIME TTY TIME CMD
999 40347 40331 18 00:58 ? 00:00:02 mysqld
View the process information of all running containers.
for i in `docker ps |grep Up|awk '{print $1}'`;do echo \ &&docker top $i; done