ChainLink节点可以向Chainlink外部适配器提出请求(在Localhost上)
我有一个在端口6688上运行的链链接节点。我正在使用Docker运行它,并带有以下命令:
cd ~/.chainlink-rinkeby && docker run -p 6688:6688 \
-v ~/.chainlink-rinkeby:/chainlink \
-it --env-file=.env \
smartcontract/chainlink:1.4.0-root local n -p /chainlink/.password -a /chainlink/.api
并且我在端口8080上运行了一个外部适配器。
如果我请求它“ data”:{“列”:[“血”,“ heath”],“ linesAmount”:500}} 它以我的正确有效载荷返回了我的正确有效载荷,以外部适配器预期的格式:
{
"jobRunID": 0,
"data": {
"ipfsHash": "anIpfshashShouldBeHere",
"providers": [
"0x03996eF07f84fEEe9f1dc18B255A8c01A4986701"
],
"result": "anIpfshashShouldBeHere"
},
"result": "anIpfshashShouldBeHere",
"statusCode": 200
}
问题IS,在链链接节点中,特别是在fetch
方法中,它给我一个错误: 错误制作http请求:发布“ http:// localhost:8080”:拨号TCP 127.0.0.1:8080:连接:连接拒绝
它与Docker容器有关吗?我不明白为什么它无法从同一台计算机中的另一个端口请求重新构造。我是否错过了一些配置? 根据我从文档中阅读的内容,可以在本地运行适配器。 下面,图片提供更多信息:
I have a chainlink Node which is running on port 6688. I'm running it with docker, with the following command:
cd ~/.chainlink-rinkeby && docker run -p 6688:6688 \
-v ~/.chainlink-rinkeby:/chainlink \
-it --env-file=.env \
smartcontract/chainlink:1.4.0-root local n -p /chainlink/.password -a /chainlink/.api
And I have an external adapter running on port 8080.
If I request it { "id": 0, "data":{ "columns": ["blood","heath"], "linesAmount":500 } }
it returns me a correct payload, in the format that is expected from the external adapter:
{
"jobRunID": 0,
"data": {
"ipfsHash": "anIpfshashShouldBeHere",
"providers": [
"0x03996eF07f84fEEe9f1dc18B255A8c01A4986701"
],
"result": "anIpfshashShouldBeHere"
},
"result": "anIpfshashShouldBeHere",
"statusCode": 200
}
The problem is, in the chainlink node, specifically in the fetch
method it gives me an error:error making http request: Post "http://localhost:8080": dial tcp 127.0.0.1:8080: connect: connection refused
Is it related to the docker container? I don't see why it wouldn't be able to request resuources from another port in the same machine. Am I missing some configuration maybe?
From what I've read from the docs it's possible to run the adapter locally.
Below, a picture with more information:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您是外部适配器(ea)在
http:// localhost:8080
上运行,并且您正在尝试从Docker内运行的链条节点到达该EA,则您无法使用<<代码> localhost ,您需要从Docker容器中出来,然后进入运行Docker Engine(Windows或Mac Machine)的主机。要这样做,因此定义您的桥以使用
http://host.docker.internal:8080
。更多详细信息可以在 docker docs 。
If you're External Adapter (EA) is running on
http://localhost:8080
and you're trying to reach that EA from a Chainlink node running inside Docker, then you can't uselocalhost
, you need to get out of the Docker container and onto the host running the Docker engine (your Windows or Mac machine).To do, so define your bridge to use
http://host.docker.internal:8080
.Further details can be found in the Docker Docs.