Skip to main content

Docker cAdvisor

· One min read
Jiaqi Liu

cAdvisor (Container Advisor) provides Docker container users an understanding of the resource usage and performance characteristics of their running containers. It is a running daemon that collects, aggregates, processes, and exports information about running containers. Specifically, for each container it keeps resource isolation parameters, historical resource usage, histograms of complete historical resource usage and network statistics. This data is exported by container and machine-wide.

Although cAdvisor has some prelimilary (useful though) UI. It also offers

  1. RESTful API to query container stats
  2. Export capability to common data storage, such as Elasticsearch

To pull the image and run it:

sudo docker run \
--volume=/:/rootfs:ro \
--volume=/var/run/docker.sock:/var/run/docker.sock:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/dev/disk/:/dev/disk:ro \
--publish=8080:8080 \
--detach=true \
--name=cadvisor \
--privileged \
--device=/dev/kmsg \
gcr.io/cadvisor/cadvisor:v0.36.0

cAdvisor Screenshot 1 cAdvisor Screenshot 2

docker-container-stats

cAdvisor is good for customizing container monitoring, but it's heavy. A quick-and-lightweight option would be docker-container-stats

docker-container-stats Screenshot