cAdvisor: A Task Manager for Containers
cAdvisor is like a task manager for your containers, giving you a live view of their resource usage. It's used to track performance, historical usage, and network stats for every container on a host.
Why it exists
Running applications in containers creates a visibility problem. Without a specialized tool, it's difficult to answer a simple question: which container is consuming how much CPU, memory, or network I/O on a host? This makes troubleshooting performance issues and capacity planning nearly impossible.
The mental model
Think of cAdvisor as a lightweight, container-aware top command that runs as a service. It's a daemon that lives on a host machine, peers into the running containers, and exposes their performance metrics through an API for other tools to consume. It's not the dashboard itself, but the data source for the dashboard.
How it works
cAdvisor runs as a daemon, typically in its own Docker container. It collects, aggregates, processes, and exports information about all running containers on its host. This includes resource isolation parameters, historical resource usage (like CPU and memory), complete histograms of that usage, and network statistics. Its container abstraction is inherently hierarchical, allowing it to understand nested container relationships. It has native support for Docker and is designed to work with other container runtimes out of the box.
When to use it
Use cAdvisor as a foundational data source for container monitoring. It's a standard way to get raw, real-time performance data from every container on a node. It is especially critical in Kubernetes, where it is often integrated into the Kubelet component on each node to provide the metrics that drive pod auto-scaling and scheduling decisions.
When not to use it
Do not rely on cAdvisor as a standalone, complete monitoring solution. It is designed to be a data exporter, not a long-term storage or visualization system. For alerting, long-term trend analysis, and dashboarding, you must pair cAdvisor with a time-series database like Prometheus to scrape and store its metrics, and a tool like Grafana to build visualizations.
One canonical example
The quickest way to try cAdvisor is by running its official Docker image. A minimal command is sudo docker run --volume=/:/rootfs:ro ... google/cadvisor:<VERSION>. This command uses a volume mount to give the cAdvisor container access to the host's root filesystem. This access is how cAdvisor discovers and gathers metrics from all other running containers on the machine. A complete, practical command would also map ports to access cAdvisor's web UI.
Interview question
Why is cAdvisor typically integrated with tools like Prometheus and Grafana?
- a.To enable centralized logging and event aggregation from containers.
- b.To extend its capability to monitor containers across multiple hosts simultaneously.
- c.To facilitate long-term metric storage, visualization, and custom alerting.Correct
- d.To provide advanced container orchestration and scheduling functionalities.
Why? this is the answer
The card states cAdvisor is a data exporter, not a long-term storage or visualization system. It explicitly recommends pairing it with Prometheus to store metrics and Grafana for visualizations, alerting, and long-term trend analysis. Option A is a plausible distractor, but the card specifically links Prometheus and Grafana to metrics, storage, and visualization, not logging.
Just read this? Test yourself on what you have been reading.
Read the original → github.com
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on docker — each one lists the topics its interview covers.
See open roles