在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/