【发布时间】:2021-08-04 09:30:54
【问题描述】:
我想 dockerize 我的 FastAPI 项目并将其连接到 PostgreSQL 实例。我正在使用 Dockerfile 对我的 python 应用程序进行 Docker 化,它可以工作,但他没有连接到 postgres 数据库。要创建 postgres 实例并尝试将其连接到我正在使用 docker compose 的服务应用程序。这是我的 docker 撰写文件
但是当我尝试使用 docker compose 启动我的应用程序时,会出现以下错误:
could not connect to server: Connection refused
Is the server running on host "0.0.0.0" and accepting
TCP/IP connections on port 5432?
【问题讨论】:
标签: postgresql docker-compose fastapi