I have a spring application which is trying to connect postgres db (jdbc:postgresql://xxxxxxx:5432/My_DB). It connects fine when I run the jar using "java -jar app.jar" command.But when i run inside the docker container it fails to connect. Below is the command , I used to run.
docker run -p 5432:5432 my_image:latest
It looks like 5432 is not open inside the container seems. I came across a similar post for this, but didnt give any solutions. Docker container for Postgres 9.1 not exposing port 5432 to host
Any thoughts on this?
Thanks