Start the stack
Start all five containers in detached mode:Docker pulls any missing images on the first run, so this may take a minute or two depending on your connection speed.
Verify all containers are running
running status:| Container | Role |
|---|---|
prometheus | Metrics collection and storage |
node-exporter | Exposes system metrics (CPU, RAM, disk) |
loki | Log storage |
promtail | Log collection and forwarding to Loki |
grafana | Unified dashboard for metrics and logs |
docker compose logs <container-name>.Open Grafana
Go to http://localhost:3000 in your browser.
The default credentials are admin / admin. Grafana will prompt you to change the password after your first login. The password is also set via the
GF_SECURITY_ADMIN_PASSWORD environment variable in docker-compose.yml.Add the Prometheus datasource
- In Grafana, go to Connections → Data sources → Add new data source.
- Select Prometheus.
- Set the URL field to:
- Click Save & test. Grafana should confirm that the datasource is working.
Add the Loki datasource
- Go to Connections → Data sources → Add new data source.
- Select Loki.
- Set the URL field to:
- Click Save & test.
| Datasource | URL |
|---|---|
| Prometheus | http://prometheus:9090 |
| Loki | http://loki:3100 |
Create or import a dashboard
With both datasources connected, you can build a dashboard or import an existing one:Example LogQL queries:
- Create a dashboard: go to Dashboards → New → New dashboard and add panels using PromQL for metrics and LogQL for logs.
- Import a dashboard: go to Dashboards → New → Import and enter a Grafana dashboard ID from grafana.com/grafana/dashboards (for example, ID
1860for the Node Exporter Full dashboard).