- modify
/etc/postgresql/9.5/main/postgresql.conf
add listen_addresses = '*'
- modify
/etc/postgresql/9.5/main/pg_hba.conf
add host all all 0.0.0.0/0 trust
-
restart postgresql
-
Add
--add-host
todocker run
command
docker run --add-host database:172.17.0.1 <container>
This will add an entry in /etc/hosts
of container with
172.17.0.1 database
- connect to postgres from docker container user
database
as host