I am trying to connect to a local postgres database (running in osx) from a docker container. I am running docker for mac. I've tried using the --add-host
option but have not gotten it to work yet. Am I missing a config to make the connection? Below is an example of what I am attempting.
docker run --add-host=localbox:192.168.59.3 -it postgres /bin/bash
connection attempts
root@1893226613e9:/# psql -h localbox -U test_user
psql: could not connect to server: Connection timed out
Is the server running on host "localbox" (192.168.59.3) and accepting
TCP/IP connections on port 5432?
root@1893226613e9:/# ping localbox
PING localbox (192.168.59.3): 56 data bytes
^C--- localbox ping statistics ---
7 packets transmitted, 0 packets received, 100% packet loss