← All bricks

Docker · Intermediate

Grafana + Loki + Prometheus Local Stack

Stand up a real local observability stack — metrics in Prometheus, logs in Loki, dashboards in Grafana — one small compose change at a time.

You cannot investigate what you cannot see. Here we build a working observability stack on a laptop with docker-compose: Prometheus for metrics, Loki for logs, Grafana to explore both, and Promtail to ship container logs. We add one service or one config file per step, with a short note on what each piece does and why it matters during an incident.

What you'll build

  • Run Prometheus, Loki and Grafana locally with docker-compose
  • Configure Prometheus scraping and Loki storage
  • Provision Grafana datasources and a dashboard as code
  • Ship container logs into Loki with Promtail

Contents

  1. What we're building
  2. Start with Prometheus
  3. How often to scrape
  4. Scrape itself first
  5. Hand the config to the container
  6. Don't lose the metrics
  7. Add Loki for logs
  8. Tell Loki where to put things
  9. Run Loki for real
  10. Add Grafana, the front door
  11. Skip the login locally
  12. Wire up Prometheus, as code
  13. And Loki too
  14. Let Grafana see the provisioning
  15. Load dashboards from a folder
  16. A first real panel
  17. Configure the log shipper
  18. Start shipping logs
  19. Bring the whole thing up