I got postgres.app running locally on my Mac and would like my local docker container to be able to connect to it. How do I best do this?
I found this post that suggests to pass the Docker host’s IP address to a container using the --add-host flag (Host port with DB to Docker container). However, my laptop's IP address changes frequently. Isn't there an easier way of doing this? Isn't there an easy way to open a local port to a container?
Few things
docker.for.mac.localhost as your HOST (This assumes you have the latest Docker for Mac as @Pete mentioned)~/Library/Application Support/Postgres/var-9.6/pg_hba.confhost all all 0.0.0.0/0 trust
listen_addresses = 'localhost' in ~/Library/Application Support/Postgres/var-9.6/postgresql.confto
listen_addresses = '*'
or
listen_addresses = 'localhost, docker.for.mac.localhost'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With