ScriptsApr 16, 2026·3 min read

cAdvisor — Real-Time Container Resource Monitoring by Google

Analyze container resource usage and performance with Google's cAdvisor. Native Docker support, Prometheus metrics export, and zero-config deployment for production container monitoring.

TL;DR
cAdvisor monitors container CPU, memory, network, and disk usage in real time with zero configuration and Prometheus integration.
§01

What it is

cAdvisor (Container Advisor) is an open-source container monitoring tool maintained by Google. It collects, aggregates, and exports resource usage and performance data from running containers. cAdvisor runs as a single container and auto-discovers all other containers on the host, providing per-container CPU, memory, network, and filesystem metrics.

The tool targets DevOps engineers, SREs, and platform teams running Docker or Kubernetes workloads who need lightweight, always-on container metrics without deploying a full monitoring stack.

§02

How it saves time or tokens

Without cAdvisor, gathering per-container metrics requires parsing docker stats output, writing custom collection scripts, or deploying heavyweight agents. cAdvisor provides a single Docker container that auto-discovers all running containers and exposes metrics in Prometheus format. No configuration files, no agent installation on the host, no custom scripts.

§03

How to use

  1. Run cAdvisor as a Docker container:
docker run -d --name=cadvisor \
  -p 8080:8080 \
  --volume=/:/rootfs:ro \
  --volume=/var/run:/var/run:ro \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  gcr.io/cadvisor/cadvisor:latest
  1. Open http://localhost:8080 to view the built-in web UI with container metrics.
  1. Point Prometheus to http://localhost:8080/metrics to scrape container metrics for dashboards.
§04

Example

# prometheus.yml - scrape cAdvisor metrics
scrape_configs:
  - job_name: 'cadvisor'
    scrape_interval: 15s
    static_configs:
      - targets: ['localhost:8080']

With this Prometheus config, container metrics flow into Grafana dashboards for visualization and alerting.

§05

Related on TokRepo

§06

Common pitfalls

  • cAdvisor's built-in web UI is useful for debugging but not suitable for long-term monitoring. Pair it with Prometheus and Grafana for production dashboards.
  • Volume mounts must be read-only and match the host filesystem layout. Missing mounts cause incomplete metrics.
  • On Kubernetes, cAdvisor is embedded in the kubelet. Running a standalone cAdvisor alongside kubelet can cause duplicate metrics collection.

Frequently Asked Questions

Is cAdvisor included in Kubernetes?+

Yes. Kubernetes embeds cAdvisor in the kubelet binary. It provides container metrics that feed into kubectl top, the Metrics Server, and Horizontal Pod Autoscaler. You do not need to deploy cAdvisor separately on K8s clusters.

What metrics does cAdvisor collect?+

cAdvisor collects CPU usage, memory usage and limits, network I/O, filesystem reads/writes, and container metadata. Metrics are available per container and per machine.

Does cAdvisor support Prometheus?+

Yes. cAdvisor exposes metrics in Prometheus format at the /metrics endpoint. Prometheus can scrape this endpoint directly for container monitoring dashboards.

How much overhead does cAdvisor add?+

cAdvisor is lightweight. It typically uses less than 100MB of memory and minimal CPU. The overhead is negligible compared to the containers it monitors, making it safe for production hosts.

Can cAdvisor monitor non-Docker containers?+

cAdvisor supports Docker, containerd, and CRI-O container runtimes. It also collects machine-level metrics for the host system regardless of container runtime.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets