3

我有一个在 docker 容器中运行的 Spring Boot 应用程序。我试图从这个应用程序连接到在 localhost 中运行的 Postgres DB。我收到连接被拒绝错误。

我尝试了下面帖子中提到的解决方案 #1 和 #3,但这也不起作用。

使用 Docker 启动 Web 应用程序,无法连接到 Postgresql DB?

到目前为止我尝试了什么

  1. Spring Boot application.properties 具有 Postgres url 作为 localhost:5432 和 docker run --add-host [dockerhost ip] -it 和 docker run --net=host -it
  2. Spring Boot application.properties 的 Postgres url 为 [dockerhost ip]:5432 和 docker run --add-host [dockerhost ip] -it 和 docker run --net=host -it

以上都不起作用。

我正在使用 Docker for Mac 1.12.5

4

0 回答 0