Monitoring Containers with cAdvisor — Part 2 of My Previous Blog Series
Raees Qazi | DevOps Engineer | Learner | Mentor | Creator | CEO-Briller Technologies
Today I’m going to talk about cAdvisor, which continues from my previous blog: https://brillertechnologies.blogspot.com/2025/11/prometheus-and-grafana-projectpart-1-by.html
After running our application, the next important step is monitoring — and for that, we use cAdvisor, a monitoring tool created by Google.

What is cAdvisor?
cAdvisor stands for Container Advisor.
Its job is to show the resource usage and performance statistics of your running containers — things like CPU, RAM, network, and filesystem usage.
cAdvisor reads data directly from Docker’s internal directory, which is located at:
/var/lib/dockerSo it needs read access to this path.
Configuring cAdvisor in Docker Compose
Now let’s update our docker-compose.yml file to include cAdvisor.
Open the file:
vim docker-compose.ymlNetworks Section
networks:
monitoring:
driver: bridgeServices Section
1. Node Todo App
services:
note-todo:
build:
context: ./node-todo-cicd
ports:
- "8000:8000"
container_name: note-todo
networks:
- monitoring2. cAdvisor Service
cadvisor:
image: gcr.io/cadvisor/cadvisor:latest
container_name: cadvisor
ports:
- "8080:8080"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
networks:
- monitoring
depends_on:
- redis3. Redis Cache
redis:
image: redis:latest
container_name: redis
ports:
- "6379:6379"
networks:
- monitoringAll services run on the same network (monitoring).
Save and exit:
:wqStart the Updated Setup
Shut down old containers:
docker compose downStart containers with the new configuration:
docker compose up -dAccessing cAdvisor
Since cAdvisor exposes port 8080, make sure this port is allowed in your EC2 Security Group.
Then open:
http://<your-ec2-ip>:8080You should now see the cAdvisor dashboard.
It will automatically collect and display the metrics for all running containers.
In this setup, we have 3 containers running:
- Node Todo App
- Redis
- cAdvisor
I hope you found this blog helpful.
Please like, share, and follow for more DevOps content.
🌐 Online References
- LinkedIn:
https://www.linkedin.com/in/raees-yaqoob-qazi-ryqs/
- Medium Blog:
https://medium.com/@raeesyaqubqazi
- Blogspot:
https://brillertechnologies.blogspot.com/
- Facebook Page:
https://web.facebook.com/profile.php?id=61553548371216
- YouTube Channel:
https://www.youtube.com/@RaeesQ.
- TikTok:
https://www.tiktok.com/@mrryqs?_t=ZS-8y7t0fQfJKu&_r=1
Comments
Post a Comment