Question

How to display the resource usage statistics of a Docker container?

Recently I was asked to provide a list of the resource usage of all Docker containers which were running on a specific node. To get this information I had to do the following:


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
November 7, 2019
Accepted Answer

I used the following Docker command:

docker stats --all

You can change the --all with -a which would do the same.

This command would provide you to a nice live stream of very useful information like the CPU usage, the RAM usage, the NET I/O and more. The output would looke something like this:


CONTAINER ID        NAME                   CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
b253d4071124        reverent_joliot        0.40%               1.703MiB / 3.853GiB   0.04%               688kB / 15.8MB      75MB / 0B           2
379cb50f3492        sharp_roentgen         0.00%               0B / 0B               0.00%               0B / 0B             0B / 0B             0

That way you could find out which container is using most of the resources on your server and possibly implement some resource limitations.

If you would like to check the resource usage for a specific container you could run:

docker stats CONTAINER_ID

If you would like to see only specific columns, you could use the --format argument:

docker stats --format "{{.Container}}: {{.CPUPerc}}"

This would return something like:

b253d4071124 0.40% 

Here is a quick video demo on how to do that as well:

For more information, I would suggest checking the official documentation here:

https://docs.docker.com/engine/reference/commandline/stats/

Hope that this helps! Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.