When using the sample docker-compose file, cloud scanner metrics scrapped by prometheus are not persisted if the prometheus container is deleted and recreated.
Reason is that we store data directly inside prometheus container, so data lifecycle is the one of the container.
Solution
Use bind mount an external data volume to the prometheus container.
# 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
Update the docker-compose file to use this external data volume instead of the default. This is similar to what we do for grafana: declare the volume , and mount it to the container in the docker-compose file.
Problem
When using the sample docker-compose file, cloud scanner metrics scrapped by prometheus are not persisted if the prometheus container is deleted and recreated.
Reason is that we store data directly inside prometheus container, so data lifecycle is the one of the container.
Solution
Use bind mount an external data volume to the prometheus container.
Update the docker-compose file to use this external data volume instead of the default. This is similar to what we do for grafana: declare the volume , and mount it to the container in the docker-compose file.
Describe this in the documentation.
Alternatives
Additional context or elements