0

I have a Spring Boot program that I'm trying to run in a docker container. But appear a problem with the connection from the container to BD that is on my host. I get an error:

org.postgresql.util.PSQLException: Connection to 127.0.0.1:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

Data source

spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/xcom

How I can connect from the container to my host? I am working on Windows

  • On Windows, you can use the host name `host.docker.internal`. `localhost` or the equivalent fixed IPv4 address `127.0.0.1` generally means "this container" in Docker, not another container or the surrounding host. – David Maze Oct 04 '21 at 20:17

0 Answers0