Telemetry collector 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/alloy
cd /path/to/docker/stacks/alloy
# paste compose.yaml below, then:
docker compose pull
docker compose up -d
---
services:
alloy:
image: grafana/alloy:latest
container_name: alloy
hostname: alloy
env_file:
- /path/to/docker/stacks/_shared/.env
- /path/to/docker/stacks/_shared/.secret
logging:
driver: json-file
options:
max-file: ${DOCKERLOGGING_MAXFILE:-10} # Max number of log files
max-size: ${DOCKERLOGGING_MAXSIZE:-200k} # Max file size
command:
- run
- --server.http.listen-addr=0.0.0.0:12345
- --storage.path=/var/lib/alloy/data
- /etc/alloy/config.alloy
ports:
- 30017:12345 # Exposes Alloy's HTTP server
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /path/to/docker/stacks/alloy/config.alloy:/etc/alloy/config.alloy:ro
- /path/to/docker/data/alloy/data:/var/lib/alloy/data
restart: unless-stopped
_shared/.secret.