Dashboards and visualization compose example.
Educational example only. Review every volume path, port, and credential before you run this. Do not copy production secrets into your wiki or git repo.
_shared/.env for non-secrets, _shared/.secret for credentialsmkdir -p /path/to/docker/stacks/grafana
cd /path/to/docker/stacks/grafana
# paste compose.yaml below, then:
docker compose pull
docker compose up -d
---
services:
grafana:
image: grafana/grafana:latest
container_name: grafana
hostname: grafana
env_file:
- /path/to/docker/stacks/_shared/.env
- /path/to/docker/stacks/_shared/.secret
mem_limit: 512m
cpu_shares: 512
security_opt:
- no-new-privileges:true
user: 0:0
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:3000/api/health
environment:
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource,natel-discrete-panel,grafana-piechart-panel
logging:
driver: json-file
options:
max-file: ${DOCKERLOGGING_MAXFILE:-10} # Max number of log files
max-size: ${DOCKERLOGGING_MAXSIZE:-200k} # Max file size
ports:
- 30000:3000
volumes:
- /path/to/docker/data/grafana:/var/lib/grafana:rw
restart: unless-stopped