docker - 运行Chainlink节点-无法连接到数据库

标签 docker blockchain psql

在macOS上使用docker-desktop。
我正在尝试按照this page上的说明运行节点。
数据库名称为node,与用户名node相同。用户有权访问数据库,并且可以使用psql客户端登录。
我在.env文件中尝试过的连接字符串:

postgresql://node@localhost/node
postgresql://node:password@localhost/node
postgresql://node:password@localhost:5432/node
postgresql://node:password@127.0.0.1:5432/node
postgresql://node:password@127.0.0.1/node
当我在macOS上使用docker-desktop运行start command:cd ~/.chainlink-kovan && docker run -p 6688:6688 -v ~/.chainlink-kovan:/chainlink -it --env-file=.env smartcontract/chainlink local n 时,得到以下堆栈跟踪:
2020-09-15T14:24:41Z [INFO]  Starting Chainlink Node 0.8.15 at commit a904730bd62c7174b80a2c4ccf885de3e78e3971 cmd/local_client.go:50
2020-09-15T14:24:41Z [INFO]  SGX enclave *NOT* loaded                           cmd/enclave.go:11
2020-09-15T14:24:41Z [INFO]  This version of chainlink was not built with support for SGX tasks cmd/enclave.go:12
2020-09-15T14:24:41Z [INFO]  Locking postgres for exclusive access with 500ms timeout orm/orm.go:69
2020-09-15T14:24:41Z [ERROR] unable to lock ORM: dial tcp 127.0.0.1:5432: connect: connection refused logger/default.go:139   stacktrace=github.com/smartcontractkit/chainlink/core/logger.Error
    /chainlink/core/logger/default.go:117
...
有谁知道我该如何解决?

最佳答案

问题出在 docker 网络上。
--network host添加到docker run命令,使其为:

cd ~/.chainlink-kovan && docker run -p 6688:6688 -v ~/.chainlink-kovan:/chainlink -it --env-file=.env smartcontract/chainlink --network host local n
这样可以解决此问题。

关于docker - 运行Chainlink节点-无法连接到数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63904185/

相关文章:

docker - 在文件 './docker-compose.yml'中,volume必须是一个映射,而不是数组

来自 ubuntu 绝对路径的 Docker COPY

docker - 使用 docker 和 kubernetes 运行 Flask 应用程序

super 账本 SBFT 与 RBFT

php - 如何使用 PHP 从 PostgreSQL 获取数据

docker - 用户尝试在unix:///var/run/docker.sock上连接到Docker守护程序套接字时拒绝了权限

python - 为什么我不能从 py-substrate-interface 发送外部数据?

ruby - 无法将非字符串解码为 common.Address 类型的 Go 结构字段 SendTxArgs.from

postgresql - 如果发生错误,如何停止并退出postgresql恢复

postgresql - 创建引用不存在的表或列的 SQL 函数(尚)