title: Postgres docker error: FATAL: password authentication failed for user
body: <p>I created a Postgres container with docker</p>
  <pre><code>sudo docker run -d \
      --name dev-postgres \
      -e POSTGRES_PASSWORD=test \
      -e POSTGRES_USER=test \
      -v ${HOME}/someplace/:/var/lib/postgresql/data \
      -p 666:5432 \
      postgres
  </code></pre>
  <p>I give the Postgres instance test as a username and password as specified <a href="https://hub.docker.com/_/postgres" rel="nofollow noreferrer">in the doc</a>.</p>
  <p>The Postgres port (5432) inside the container is linked to my 666 port on the host.</p>
  <p>Now I want to try this out using psql</p>
  <pre><code>psql --host=localhost --port=666 --username=test
  </code></pre>
  <p>I'm prompted to enter the password for user test and after entering test, I get</p>
  <pre><code>psql: error: FATAL:  password authentication failed for user &quot;test&quot;
  </code></pre>