version: '3.8'
services:
prometheus:
image: prom/prometheus:v2.31.1
container_name: prometheus
volumes:
# Config
- /srv/prometheus/etc/prometheus/:/etc/prometheus/:ro
# Data
- /srv/prometheus/prometheus/:/prometheus/
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--web.console.libraries=/usr/share/prometheus/console_libraries"
- "--web.console.templates=/usr/share/prometheus/consoles"
# Keep data for 3 months
- --storage.tsdb.retention.time=90d
# Listen on port 9090 inside container
- --web.listen-address=:9090
# Use TLS with Basic Auth
- --web.config.file=/etc/prometheus/web-config.yml
ports:
- 443:9090
restart: on-failure:3