title: How to persist data in Prometheus running in a Docker container?
body: <p>I'm developing something that needs Prometheus to persist its data between restarts. Having followed the instructions </p>
  
  <pre><code>$ docker volume create a-new-volume
  $ docker run \
      --publish 9090:9090 \
      --volume a-new-volume:/prometheus-data \
      --volume "$(pwd)"/prometheus.yml:/etc/prometheus/prometheus.yml \
      prom/prometheus
  </code></pre>
  
  <p>I have a valid <code>prometheus.yml</code> in the right directory on the host machine and it's being read by Prometheus from within the container. I'm just scraping a couple of HTTP endpoints for testing purposes at the moment.</p>
  
  <p>But when I restart the container it's empty, no data from the previous run. What am I missing from my <code>docker run ...</code> command to persist the data into the <code>a-new-volume</code> volume?</p>