cAdvisor (Container Advisor) is an open-source daemon from Google that collects, aggregates, and exports real-time resource usage and performance metrics for every running container on a host. Unlike Node Exporter, which reports host-level statistics, cAdvisor descends into cgroup hierarchies to expose per-container CPU, memory, network, and filesystem metrics in Prometheus format. On RHEL 8 with Docker installed, you can deploy cAdvisor as a single privileged container in under two minutes. This tutorial covers that deployment, verifying the metrics endpoint, wiring cAdvisor into Prometheus, understanding the key container metrics, and importing a pre-built Grafana container dashboard.

Prerequisites

  • RHEL 8 server with Docker installed and running
  • Prometheus already installed and scraping host metrics
  • Grafana installed and connected to the Prometheus data source
  • Port 8080 open in the firewall for the cAdvisor web UI and metrics endpoint
  • sudo privileges on the host

Step 1 — Open the Firewall Port

Allow inbound traffic on port 8080 before starting the cAdvisor container so the web UI and /metrics endpoint are reachable.

sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
sudo firewall-cmd --list-ports

Step 2 — Deploy cAdvisor with Docker

Run cAdvisor as a privileged container with read-only bind mounts to the host’s root filesystem, Docker socket, and sysfs. The --privileged flag and the volume mounts are required for cAdvisor to read cgroup and Docker metadata on RHEL 8.

sudo docker run -d 
  --name cadvisor 
  --restart=always 
  --privileged 
  -p 8080:8080 
  -v /:/rootfs:ro 
  -v /var/run:/var/run:ro 
  -v /sys:/sys:ro 
  -v /var/lib/docker/:/var/lib/docker:ro 
  -v /dev/disk/:/dev/disk:ro 
  gcr.io/cadvisor/cadvisor:latest

sudo docker ps --filter name=cadvisor

If gcr.io is unreachable from your network, pull the image via an allowed registry mirror or use the GitHub Container Registry alternative: ghcr.io/google/cadvisor:latest.

Step 3 — Verify the Metrics Endpoint

cAdvisor exposes its built-in web UI on / and Prometheus metrics on /metrics. Confirm both are working before configuring Prometheus to scrape them.

# Check the web UI is responding
curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/
# Expected: 200

# Preview the first 30 lines of the Prometheus metrics output
curl -s http://localhost:8080/metrics | head -30

# Confirm key container metrics are present
curl -s http://localhost:8080/metrics | grep -E "^container_cpu_usage|^container_memory_usage"

You should see metrics lines beginning with container_cpu_usage_seconds_total and container_memory_usage_bytes labelled with container, image, and id labels.

Step 4 — Add cAdvisor to Prometheus scrape_configs

Edit your Prometheus configuration to add a scrape job for the cAdvisor endpoint. The default scrape interval of 15 seconds is appropriate for container metrics.

# In /etc/prometheus/prometheus.yml, add the following job:
scrape_configs:
  - job_name: cadvisor
    scrape_interval: 15s
    static_configs:
      - targets: ['localhost:8080']
        labels:
          host: rhel8-server-01

# Reload Prometheus to apply the change
sudo systemctl reload prometheus

# Confirm cAdvisor target is up in the Prometheus UI
curl -s http://localhost:9090/api/v1/targets 
  | python3 -m json.tool 
  | grep -A5 '"cadvisor"'

After one scrape interval, the target should show state: up in the Prometheus UI at http://localhost:9090/targets.

Step 5 — Key Container Metrics to Query

The following PromQL expressions cover the most operationally useful container signals. Use them in Grafana panels or Prometheus alerting rules.

# CPU usage rate per container (cores used, last 5 minutes)
rate(container_cpu_usage_seconds_total{name!=""}[5m])

# CPU usage as a percentage of a 1-core limit
rate(container_cpu_usage_seconds_total{name!=""}[5m]) * 100

# Memory usage in bytes per container
container_memory_usage_bytes{name!=""}

# Memory usage excluding cache (RSS — resident set size)
container_memory_rss{name!=""}

# Memory limit per container (set via docker run --memory)
container_spec_memory_limit_bytes{name!=""}

# Memory usage as % of limit
(container_memory_usage_bytes{name!=""} /
 container_spec_memory_limit_bytes{name!=""}) * 100

# Network received bytes per second per container
rate(container_network_receive_bytes_total{name!=""}[5m])

# Network transmitted bytes per second per container
rate(container_network_transmit_bytes_total{name!=""}[5m])

# Filesystem reads per second
rate(container_fs_reads_bytes_total{name!=""}[5m])

# Number of running containers (host-level)
count(container_last_seen{name!="",image!=""})

Step 6 — Import a Grafana Container Dashboard

Rather than building container panels from scratch, import the widely-used community dashboard (ID 14282 — “Docker and OS metrics for Prometheus”) or the official cAdvisor dashboard (ID 19792).

# In the Grafana UI:
# 1. Click "Dashboards" in the left sidebar
# 2. Click "New" → "Import"
# 3. Enter dashboard ID: 14282  (or 19792 for the official cAdvisor dashboard)
# 4. Click "Load"
# 5. Select your Prometheus data source from the dropdown
# 6. Click "Import"

# Alternatively, download the JSON and import it via the API:
curl -s "https://grafana.com/api/dashboards/14282/revisions/1/download" 
  -o /tmp/cadvisor_dashboard.json

curl -s -u admin:admin 
  -X POST 
  -H "Content-Type: application/json" 
  -d "{"dashboard": $(cat /tmp/cadvisor_dashboard.json), "overwrite": true}" 
  http://localhost:3000/api/dashboards/import

After import, use the hostname or container template variable dropdowns at the top of the dashboard to filter the view to a specific host or individual container.

Conclusion

You have deployed cAdvisor on RHEL 8 as a Docker container with the necessary privileged mounts, verified the Prometheus metrics endpoint, integrated it into your Prometheus scrape configuration, and imported a Grafana dashboard providing instant visibility into per-container CPU, memory, network, and filesystem usage. cAdvisor requires no code changes to your application containers and scales automatically — any new container started on the host appears in the metrics within one scrape interval. Combined with Node Exporter for host-level data and the Blackbox Exporter for endpoint probing, cAdvisor completes a comprehensive observability stack for RHEL 8 hosts running Docker workloads.

Next steps: How to Build Grafana Dashboards for Linux Server Metrics on RHEL 8, How to Set Up Uptime Kuma for Service Monitoring on RHEL 8, and How to Use Prometheus Blackbox Exporter for Endpoint Monitoring on RHEL 8.