title: Postgres docker container external access issue when using a bind mounted data directory with pre-existing database
body: <p>I am trying to use the data directory from a preexisting database &amp; bring up a new postgres docker container (same version 9.5) with its '/var/lib/postgresql/data' bind mounted to the data directory.</p>
  <p>I find that even though i am able to bring up the container &amp; use psql within the container to connect to it, external connections fail with invalid password. This despite me setting the POSTGRES_USER, POSTGRES_DB &amp; POSTGRES_PASSWORD environment variables.</p>
  <p>Is there a way to make this work? I also tried <a href="https://stackoverflow.com/questions/47615751/docker-compose-run-a-script-after-container-has-started">this</a> method but ran into permission error,</p>
  <blockquote>
  <p>&quot;sh: 1: /usr/local/bin/init.sh: Permission denied&quot;</p>
  </blockquote>
  <p>Thanks</p>