All tools / Docker Compose examples
Grafana with Docker Compose
Grafana with a named volume, an admin password and a Prometheus data source provisioned on start.
Customize names, versions and passwords →
compose.yaml
services:
grafana:
image: grafana/grafana:12.0.0
restart: unless-stopped
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: "change-me"
configs:
- source: grafana_datasources
target: /etc/grafana/provisioning/datasources/datasources.yaml
volumes:
- grafana-data:/var/lib/grafana
ports:
- "127.0.0.1:3000:3000"
configs:
grafana_datasources:
content: |
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
volumes:
grafana-data:
Passwords here are placeholders (change-me). The generator creates random ones for you.
How to use it
Commands
docker compose up -d docker compose ps docker compose logs -f
- Open http://localhost:3000 and log in as admin.
Prefer Kubernetes? See the Grafana Kubernetes version.