21 lines
723 B
YAML
21 lines
723 B
YAML
services:
|
|
prometheus:
|
|
image: prom/prometheus:latest
|
|
container_name: prometheus
|
|
ports:
|
|
- "9090:9090"
|
|
command:
|
|
# Tell Prometheus to use the mounted configuration file
|
|
- --config.file=/etc/prometheus/prometheus.yml
|
|
# Tell Prometheus where to store its time series data
|
|
- --storage.tsdb.path=/prometheus
|
|
volumes:
|
|
# 1. Mount the local prometheus.yml file into the container's config path
|
|
- ./prometheus.yml:/etc/prometheus/prometheus.yml
|
|
# 2. Use a named volume for persistent storage of the time series data
|
|
- prometheus_data:/prometheus
|
|
restart: unless-stopped
|
|
|
|
# Define the named volume for persistent data storage
|
|
volumes:
|
|
prometheus_data: {} |