The docker top command
You can run the top
command from the Docker host machine using the following command:
docker top [OPTIONS] CONTAINER [ps OPTIONS]
This gives a list of the running processes of a container without logging in to the container, as follows:
$ sudo docker top a245253db38b UID PID PPID C STIME TTY TIME CMD root 5232 3585 0 Mar22 ? 00:00:53 python app.py $ sudo docker top a245253db38b -aef UID PID PPID C STIME TTY TIME CMD root 5232 3585 0 Mar22 ? 00:00:53 python app.py
The Docker top
command provides information about the CPU, memory, and swap usage if you run it inside a Docker container:
root@a245253db38b:/opt/webapp# top top - 19:35:03 up 25 days, 15:50, 0 users, load average: 0.00, 0.01, 0.05 Tasks: 3 total,...