This project sets up a complete monitoring and logging stack using Docker Compose.
- Prometheus – Metrics collection and alerting
- Grafana – Visualization and dashboarding
- Loki – Log aggregation system by Grafana
- Promtail – Log shipping agent for Loki
- Node Exporter – Host-level metrics for Prometheus
git clone https://github.com/yourusername/docker-monitoring.git
cd docker-monitoringdocker compose up -d
This will pull all required images and start the containers in the background.
| Service | URL | Default Credentials |
|---|---|---|
| Grafana | http://localhost:3000 | admin / admin |
| Prometheus | http://localhost:9090 | N/A |
| Loki | http://localhost:3100 | N/A |
| Node Exporter | http://localhost:9100 | N/A |
Visit http://localhost:3000 and log in with:
Username: admin
Password: admin
If not auto-provisioned, configure the following:
-
Prometheus at
http://prometheus:9090 -
Loki at
http://loki:3100
You can import dashboards from Grafana.com:
-
Node Exporter Full (ID:
1860) -
Loki Logs Dashboard (ID:
13665)
-
prometheus/prometheus.yml– Prometheus scrape configuration -
promtail/config.yml– Promtail log collection rules -
grafana/provisioning/– Optional folder to auto-provision data sources/dashboards
-
Promtail reads logs from
/var/logand/var/lib/docker/containers -
Node Exporter reads system metrics from host via
/proc,/sys, and root FS
docker compose down
To remove all volumes and start fresh:
docker compose down -v
Make sure Docker has access to system folders (/var/log, /var/lib/docker, /proc, etc.) and your user has permission to bind to these files on macOS/Linux.
- Check logs:
docker compose logs -f
-
Verify Prometheus targets:
-
Go to Status > Targets in Prometheus UI
-
Grafana dashboards not showing data? Check:
-
Data source config
-
Time range in dashboard
-
Prometheus targets scraping successfully
-
Apache 2
#courses/docker/labs-v2