[英]Chainlink node can't make requests to Chainlink external adapter (on localhost)
I have a chainlink Node which is running on port 6688. I'm running it with docker, with the following command:我有一个在端口 6688 上运行的 chainlink 节点。我使用 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
And I have an external adapter running on port 8080.我有一个在端口 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:如果我请求它
{ "id": 0, "data":{ "columns": ["blood","heath"], "linesAmount":500 } }
它会以预期的格式返回正确的有效负载从外部适配器:
{
"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
问题是,在chainlink节点中,特别是在
fetch
方法中,它给了我一个错误: 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?它与docker容器有关吗? 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:
下面是一张包含更多信息的图片:
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 use localhost
, you need to get out of the Docker container and onto the host running the Docker engine (your Windows or Mac machine).如果您的外部适配器 (EA) 在
http://localhost:8080
上运行,并且您试图从运行在 Docker 内的 Chainlink 节点访问该 EA,那么您不能使用localhost
,您需要退出Docker 容器和运行 Docker 引擎的主机(您的 Windows 或 Mac 机器)。
To do, so define your bridge to use http://host.docker.internal:8080
.为此,请定义您的网桥以使用
http://host.docker.internal:8080
。
Further details can be found in the Docker Docs .更多细节可以在Docker 文档中找到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.