title: Docker Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections
body: <p>While following a tutorial for  Full stack spring boot &amp; React course. I'm currently find it difficult to get past the flyway &amp; migrations section of the course. I currently have installed PostgreSQL on to docker on port 5432. However, I get this error response when I run my spring boot app trying to create a student table in the PostgreSQL database.</p>
  <p><code>org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.</code></p>
  <p>In my application.yml</p>
  <pre><code>  servlet:
      context-path: /api
  
  app:
    datasource:
      jdbc-url: jdbc:postgresql://localhost/springbootdemo
      username: postgres
      password: password
      pool-size: 30
  </code></pre>
  <p>FYI, this is my first time utilizing docker.</p>
  <p>Also, I have docker up &amp; running while I run my springboot app to create the student table.</p>
  <p>I'll appreciate all inputs on how I can solve this issue.</p>