首页 > 解决方案 > Hassura 容器未连接到在 localhost 上运行的 postgres

问题描述

我尝试使用以下命令在 mac 上运行 Hasura docker 容器:-

docker run -d -p 8080:8080 \
  -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@host.docker.internal:5432/dbname \
  -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \
  hasura/graphql-engine:latest

容器退出并出现以下错误


{"type":"pg-client","timestamp":"2020-06-17T06:09:42.825+0000","level":"warn","detail":{"message":"postgres connection failed, retrying(0)."}}
{"type":"pg-client","timestamp":"2020-06-17T06:09:42.825+0000","level":"warn","detail":{"message":"postgres connection failed, retrying(1)."}}
{"type":"startup","timestamp":"2020-06-17T06:09:42.825+0000","level":"error","detail":{"kind":"db_migrate","info":{"internal":"no connection to the server\n","path":"$","error":"connection error","code":"postgres-error"}}}

但最初我得到了与权限相关的错误用户没有权限创建 pgcrypto 扩展,那时它会连接到 Postgres 权限。

启用 pgcrypto 扩展后,它无法连接到 Postgres。

标签: postgresqldocker

解决方案


推荐阅读