- Docker Engine metrics — metrics about the Docker daemon/engine itself.
- Per-container metrics — detailed container-level CPU, memory, filesystem, and process information exposed by cAdvisor.

1. Enable Docker Engine metrics
Docker can expose runtime metrics directly from the daemon. This is useful for monitoring the Docker engine itself (daemon CPU, errors, image/operation counts, etc.), and is configured on the host running Docker. Create or edit/etc/docker/daemon.json and add the metrics address and enable experimental features:
Exposing Docker metrics via the daemon is an experimental feature. Use it for testing or in environments where experimental features are acceptable.
127.0.0.1 with the Docker host IP or hostname:
- Use a stable hostname or IP for the target so Prometheus can reliably scrape metrics.
- Consider network/firewall rules and authentication if scraping remotely.
2. Enable cAdvisor for per-container metrics
cAdvisor (Container Advisor) provides per-container metrics: CPU, memory, filesystem usage, process counts, and container uptime. Run cAdvisor on the Docker host so it can inspect containers and the host filesystem. Exampledocker-compose.yml for cAdvisor:
https://github.com/google/cadvisor.
cAdvisor requires elevated privileges and host volumes to provide accurate metrics. Run it only on trusted hosts and review security implications (
privileged: true, host mounts).3. What metrics to expect
- Docker Engine metrics: engine/daemon-level metrics such as daemon CPU usage, queue lengths, API request durations, image build counts, and engine errors.
- cAdvisor metrics: per-container resource metrics — CPU and memory usage by container, filesystem I/O, process counts inside containers, and container lifetime statistics.
4. Quick comparison
5. Troubleshooting checklist
- If
curlto the metrics endpoint times out, check firewall rules and whether Docker/cAdvisor is bound to localhost vs 0.0.0.0. - Use correct host/IP in Prometheus
targetswhen Prometheus is remote. - Confirm container mounts and privileges for cAdvisor if metrics are missing or incomplete.
- Check Docker daemon logs (
sudo journalctl -u docker) for errors after editingdaemon.json.
Links and references
- Prometheus documentation: https://prometheus.io/docs/
- cAdvisor GitHub:
https://github.com/google/cadvisor - Docker daemon docs: https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file
