【发布时间】:2019-01-31 23:58:47
【问题描述】:
我有 django 应用程序,我试图在 docker 中托管。在启动 django 应用程序之前,我未能成功启动我的 postgres 服务器。这是我的docker-compose.yaml
version: '3'
services:
flyway:
image: boxfuse/flyway
command: -url=jdbc:postgresql://db/dbname -schemas=schemaName -user=user -password=pwd migrate
volumes:
- ./flyway:/flyway/sql
depends_on:
- db
db:
image: postgres:9.6
restart: always
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=pwd
healthcheck:
test: "pg_isready -q -U postgres"
app:
image: myimage
ports:
- 8000:8000
db 和 app 服务似乎都很好,但我无法使用 flyway 启动 postgres 默认值。以下是我遇到的错误:
flyway_1 | SEVERE: Connection error:
flyway_1 | org.postgresql.util.PSQLException: Connection to db:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
ERROR:
flyway_1 | Unable to obtain connection from database (jdbc:postgresql://db/dbname) for user 'user': Connection to db:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
我找不到一个很好的例子来说明如何将 flyway 与 Postgres 一起使用。我该如何让它发挥作用? TIA
【问题讨论】:
标签: postgresql docker-compose flyway