Merge pull request #8747 from shoce/patch-1

Add instructions how to persist prometheus docker container data
This commit is contained in:
Julien Pivotto 2023-07-26 09:02:48 +02:00 committed by GitHub
commit 03e549cc39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,6 +55,23 @@ docker run \
prom/prometheus prom/prometheus
``` ```
### Save your Prometheus data
Prometheus data is stored in `/prometheus` dir inside the container, so the data is cleared every time the container gets restarted. To save your data, you need to set up persistent storage (or bind mounts) for your container.
Run Prometheus container with persistent storage:
```bash
# Create persistent volume for your data
docker volume create prometheus-data
# Start Prometheus container
docker run \
-p 9090:9090 \
-v /path/to/prometheus.yml:/etc/prometheus/prometheus.yml \
-v prometheus-data:/prometheus \
prom/prometheus
```
### Custom image ### Custom image
To avoid managing a file on the host and bind-mount it, the To avoid managing a file on the host and bind-mount it, the