Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check Resources Used by each Docker Container

How do you check the amount of resources (CPU, memory etc) being used by each Docker container that is running on the (Ubuntu) server?

like image 384
Nyxynyx Avatar asked Jul 01 '15 05:07

Nyxynyx


Video Answer


2 Answers

you have docker stats see the doc

http://docs.docker.com/reference/commandline/stats/

for example you can do

docker stats $(docker ps -q)

(that will display the id of the containers or if you want the name, see

Is there any way to display container names in docker stats?

, you can also you docker top if you are interested in a specific container

http://docs.docker.com/reference/commandline/top/

like image 127
user2915097 Avatar answered Oct 26 '22 15:10

user2915097


this displays real-time resource usage across all running containers on a single docker engine or entire swarm cluster

docker stats $( docker ps --format '{{ .Names }}' )

sample output

CONTAINER              CPU %               MEM USAGE / LIMIT     MEM %               NET I/O               BLOCK I/O           PIDS
dockercoins_webui_1    0.66%               19.23 MB / 16.72 GB   0.12%               309.8 kB / 605.8 kB   61.44 kB / 0 B      9
dockercoins_worker_1   4.01%               13.18 MB / 16.72 GB   0.08%               834.5 kB / 920.5 kB   98.3 kB / 0 B       1
dockercoins_rng_1      0.70%               19.03 MB / 16.72 GB   0.11%               412.8 kB / 441.7 kB   2.388 MB / 0 B      1
dockercoins_hasher_1   0.59%               19.67 MB / 16.72 GB   0.12%               477.6 kB / 372.7 kB   1.438 MB / 0 B      22
dockercoins_redis_1    0.18%               6.877 MB / 16.72 GB   0.04%               178.8 kB / 80.11 kB   5.771 MB / 0 B      3
web                    0.02%               11.06 MB / 16.72 GB   0.07%               87.19 kB / 648 B      0 B / 0 B           1
db                     0.01%               14.11 MB / 16.72 GB   0.08%               87.84 kB / 648 B      0 B / 9.851 MB      7
like image 28
Scott Stensland Avatar answered Oct 26 '22 17:10

Scott Stensland