title: How to access host DB from Docker container?
body: <p>I have PostgreSQL DB running locally and a Docker container with an application that wants to connect there.</p>
  
  <p>How can I access localhost DB from inside docker?</p>
  
  <pre><code>docker run --rm -e "DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5432/my_db" --network="host" -p 4000:4000 my_image
  </code></pre>
  
  <p>The above doesn't seem to work. Neither this one: <a href="https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach">From inside of a Docker container, how do I connect to the localhost of the machine?</a></p>