title: Why docker-compose down deletes my volume? how to avoid this action done by 'down'. (Postgresql)
body: <p>when I run docker-compose down without <code>-v</code> or <code>--volumes</code>, why my data is lost? Does docker delete my volume?<br />
  When I inspect the &quot;docker volume inspect pgdata&quot;, it shows up always the current timestamp, looks like it is always recreated each time.</p>
  <p>But when I just stopped the postgres container docker stop containerid and re-run the container, the data is still there.</p>
  <pre><code>version: '3.7'
  services:
  app:
  container_name: bsf-quiz-app
  image: sapkotasuren/bsf-quiz
  ports:
  - &quot;443:8443&quot;
  depends_on:
  - postgresqldb
  postgresqldb:
  image: postgres:latest
  ports:
  - &quot;5432:5432&quot;
  volumes:
  - pgdata:/var/lib/postgresql/data
  environment:
  - POSTGRES_PASSWORD=password
  - POSTGRES_USER=postgres
  - POSTGRES_DB=bsfQuiz
  </code></pre>
  <p>volumes:<br />
  pgdata:</p>
  <p><a href="https://www.codepile.net/pile/YbkRvKEr" rel="nofollow noreferrer">https://www.codepile.net/pile/YbkRvKEr</a></p>
  <p>---updated 20/01/2021------------<br/>
  I tried to do it on bind mount way, i see lot of data being created but still the same issue could not find the record which i have created before on the database, after docker-compose down and up.</p>
  <p>I also tried to create named volume using docker command: docker create volume postgres, and mention it on my yaml file and set external to true. still the same issue!</p>
  <p>yaml file can be found here: <a href="https://www.codepile.net/pile/MmbZkxmK" rel="nofollow noreferrer">https://www.codepile.net/pile/MmbZkxmK</a></p>