title: How to have host machine postgres data in docker container using volumes?
body: <p>I have some data in my host machine which I want the container to use. I can do this by taking dump from my host machine and ingesting the same while postgres is starting in the container. But this is not how I wanted it to be. </p>
  
  <p>I'm trying to leverage docker volumes to be able to use host machine data in container so whenever any new data is added or removed to postgres on container it should also reflect on the host machine.</p>
  
  <p>Here's my <code>docker-compose.yml</code> file.</p>
  
  <pre><code>version: '3.2'
  
  services:
        postgresql:
          image: postgres:9.6.8
          ports:
            - '5432:5432'
          volumes:
            - /var/lib/postgresql/9.6/main:/var/lib/postgresql/data
  </code></pre>
  
  <p><code>/var/lib/postgresql/data</code> is the default PGDATA location in official postgres docker image.</p>
  
  <p>With the above <code>docker-compose.yml</code> file and trying with multiple volume mappings, I'm unable to find host machine data in container.</p>