From 8f33b8bd2cdbe6a59705773e86ea84bd28325b7c Mon Sep 17 00:00:00 2001 From: shoce Date: Mon, 18 Oct 2021 22:43:31 +0530 Subject: [PATCH] Add instructions how to persist prometheus docker container data Signed-off-by: shoce --- docs/installation.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/installation.md b/docs/installation.md index 592d67b28..36ff61b36 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -55,6 +55,23 @@ docker run \ 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 To avoid managing a file on the host and bind-mount it, the