diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..61e072b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +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: {} \ No newline at end of file