I'm trying to make a few containers that are started by a docker-compose to work with a remote AWS database (managed by Heroku). I configured the envs as shown bellow:
environment:
- PG_HOST=xxx.compute-1.amazonaws.com
- PG_USER=xxx
- PG_PASS=xxx
- PG_DBNAME=xxx
- PG_PORT=5432
My problem is that the app recognizes the envs and returns a 'success' message as: Ready hosting xxx.compute-1.amazonaws.com to port 5432 !
but follows with a driver fail to pq: no pg_hba.conf entry for host "<gateway>", user "xxx", database "xxx", SSL off
I've tried copying a custom pg_hba.conf as follows to the container's volume /var/lib/postgresql/data:
local all all all trust
host all all all trust
Also tried specifying the container's network_mode as network_mode: host, but it fails the same way.