简体   繁体   中英

How do I connect to the host machine's Postgres from Docker?

I want to connect to Postgres on my host machine from docker to deploy ODKAggregate. Here is my docker file:

FROM tomcat:8.5.16-jre8-alpine
MAINTAINER Brian Otieno "obrienotieno@icloud.com" 
CMD ["catalina.sh", "run"]

How do I tweak the Dockerfile to listen to Postgres on the host?

Change listen_address on to * from /var/lib/pgsql/data/postgresql.conf

This basically allows any IP to connect to your Postgres, the default will be localhost

sudo nano /var/lib/pgsql/data/postgresql.conf

And change like this listen_addresses = '*'

And change your project settings to connect with your host system Postgres port

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM