I have a Spring Boot application that is running in a docker container. From this application I am trying to connect to a Postgres DB that is running in localhost. I am getting Connection refused error.
I tried solution #1 & #3 mentioned in the below post, but that is also not working.
Using Docker to launch web app, can't connect to Postgresql DB?
What I tried so far
- Spring Boot application.properties has Postgres url as localhost:5432 and docker run --add-host [dockerhost ip] -it and docker run --net=host -it
- Spring Boot application.properties has Postgres url as [dockerhost ip]:5432 and docker run --add-host [dockerhost ip] -it and docker run --net=host -it
Neither of the above is working.
I am using Docker for Mac 1.12.5