All tools / Docker Compose examples
Loki with Docker Compose
Grafana Loki in single-binary mode with filesystem storage and 31-day retention.
compose.yaml
services:
loki:
image: grafana/loki:3.5.0
restart: unless-stopped
command: ["-config.file=/etc/loki/loki.yaml"]
configs:
- source: loki_config
target: /etc/loki/loki.yaml
volumes:
- loki-data:/loki
ports:
- "127.0.0.1:3100:3100"
configs:
loki_config:
content: |
auth_enabled: false
server:
http_listen_port: 3100
common:
instance_addr: 127.0.0.1
path_prefix: /loki
storage:
filesystem:
chunks_directory: /loki/chunks
rules_directory: /loki/rules
replication_factor: 1
ring:
kvstore:
store: inmemory
schema_config:
configs:
- from: 2024-01-01
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
limits_config:
retention_period: 744h
compactor:
working_directory: /loki/compactor
retention_enabled: true
delete_request_store: filesystem
volumes:
loki-data:
How to use it
Commands
docker compose up -d docker compose ps docker compose logs -f
- Add it in Grafana as a Loki data source at http://loki:3100. Ship logs to it with Grafana Alloy or the Docker Loki logging driver.
Prefer Kubernetes? See the Loki Kubernetes version.