I have 2 Docker containers running on Centos machine

for Docker memory monitoring purpose, I have installed "cadvisor" on the machine via Docker images

when I compare "Docker stats" and "cadvisor" value then I see that cadvisor shows more memory usage than docker stats

for example, the value of memory usage in Docker stats command for one container is 520 MiB but in cadvisor value is 756 MiB

Which one is right ?

1 Answers

amoskaliov On

According to Docker docs:

On Linux, the Docker CLI reports memory usage by subtracting page cache usage from the total memory usage.


So, to get from cAdvisor the same value as docker stats show, you can use the following expression: container_memory_usage_bytes - container_memory_cache

I tried it out and got exactly the same values as docker stats produces.