【发布时间】:2021-03-25 04:30:21
【问题描述】:
- 在 WSL2 中运行的 Docker 桌面 (windows10)
- 在 WSL2 中运行的 postgresql
- pgadmin 在 windows10 中运行
我可以使用默认设置将 pgadmin(本地机器)连接到 postgresql(本地机器 WSL2) (本地主机:5432)
postgres.conf
listen_addresses = '*'
port = 5432
当我创建一个 docker 容器时,它不会连接到我的本地 postgresql。
WSL2中使用的cmd
docker run -d --net=host \
-e HASURA_GRAPHQL_DATABASE_URL=postgres://postgres:password@localhost:5432/mydb \
-e HASURA_GRAPHQL_ENABLE_CONSOLE=true \
-e HASURA_GRAPHQL_DEV_MODE=true \
hasura/graphql-engine:v1.3.3
错误
"could not connect to server: Connection refused\n\tIs the server running on host \"localhost\" (127.0.0.1) and accepting\n\tTCP/IP connections on port 5432?\n","path":"$","error":"connection error","code":"postgres-error"}
我错过了什么?
【问题讨论】:
标签: postgresql docker hasura