title: Trouble connecting to postgres from docker-compose on ubuntu
body: <p>I'm trying to connect to my postgres database running on Ubuntu 18.04 hosted on digital ocean, from a docker-compose.yml file. The .yml file consist of the following:</p>
  
  <pre><code>version: '3'
  services:
    prisma:
      image: prismagraphql/prisma:1.32
      restart: always
      ports:
        - '4466:4466'
      environment:
        PRISMA_CONFIG: |
          port: 4466
          # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
          # managementApiSecret: my-secret
          databases:
            default:
              connector: postgres
              host: droplet-ip
              database: my-database
              user: my-user
              password: my-password
              rawAccess: false
              port: 5432
              migrations: true
  </code></pre>
  
  <p>I have tried using 'localhost', '127.0.0.1' and 'host.docker.internal' as host, none of it is working. I've configured the pg_hba.conf to listen on range 127.0.0.1/16 and postgresql.conf's listen_address = '*'. I get the following logs from postgres when trying to connect:</p>
  
  <pre><code>No log level set, defaulting to INFO.
  [INFO] {} - Started.
  Jun 25, 2019 2:10:40 PM org.postgresql.core.v3.ConnectionFactoryImpl log
  WARNING: IOException occurred while connecting to droplet-ip:5432
  java.net.SocketTimeoutException: connect timed out
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      at java.net.Socket.connect(Socket.java:589)
      at org.postgresql.core.PGStream.&lt;init&gt;(PGStream.java:69)
      at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:156)
      at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
      at org.postgresql.jdbc.PgConnection.&lt;init&gt;(PgConnection.java:195)
      at org.postgresql.Driver.makeConnection(Driver.java:452)
      at org.postgresql.Driver.connect(Driver.java:254)
      at slick.jdbc.DriverDataSource.getConnection(DriverDataSource.scala:101)
      at slick.jdbc.DataSourceJdbcDataSource.createConnection(JdbcDataSource.scala:68)
      at slick.jdbc.JdbcBackend$BaseSession.&lt;init&gt;(JdbcBackend.scala:453)
      at slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:46)
      at slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:37)
      at slick.basic.BasicBackend$DatabaseDef.acquireSession(BasicBackend.scala:249)
      at slick.basic.BasicBackend$DatabaseDef.acquireSession$(BasicBackend.scala:248)
      at slick.jdbc.JdbcBackend$DatabaseDef.acquireSession(JdbcBackend.scala:37)
      at slick.basic.BasicBackend$DatabaseDef$$anon$2.run(BasicBackend.scala:274)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
  
  Jun 25, 2019 2:10:40 PM org.postgresql.core.v3.ConnectionFactoryImpl log
  WARNING: IOException occurred while connecting to 68.183.40.242:5432
  java.net.SocketTimeoutException: connect timed out
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      at java.net.Socket.connect(Socket.java:589)
      at org.postgresql.core.PGStream.&lt;init&gt;(PGStream.java:69)
      at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:156)
      at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
      at org.postgresql.jdbc.PgConnection.&lt;init&gt;(PgConnection.java:195)
      at org.postgresql.Driver.makeConnection(Driver.java:452)
      at org.postgresql.Driver.connect(Driver.java:254)
      at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:95)
      at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:341)
      at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:193)
      at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:430)
      at com.zaxxer.hikari.pool.HikariPool.access$500(HikariPool.java:64)
      at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:570)
      at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:563)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  </code></pre>
  
  <p>I'm using docker-compose, ubuntu 18.04 and postgreSQL 10.</p>
  
  <p>Any idea where I might go wrong here?</p>