我正在尝试从主机对位于Docker容器内的应用程序进行调用。
虽然端口7777已暴露:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e447cb3d2db5 eosio/eos "/bin/bash" 3 days ago Up 3 days 0.0.0.0:7777->7777/tcp server
发出卷曲请求时,出现400错误请求错误。
$ curl -vv -X POST http://127.0.0.1:7777/v1/chain/get_info
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 7777 (#0)
> POST /v1/chain/get_info HTTP/1.1
> Host: 127.0.0.1:7777
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 400 Bad Request
码头工人网络是:
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
d3d275c83226 bridge bridge local
9f6a5439c22c eosnetwork bridge local
db156b84ea13 host host local
83e9116a4419 none null local
主机是linux / ubuntu机器(我读过类似的问题,但仅在Windows上)。 是否知道为什么会发生以及如何解决? 让我知道您是否需要更多信息
卷曲到容器的ip:
$ curl -X POST http://172.18.0.2:7777/v1/chain/get_info
{"server_version":"08819aae","chain_id":"aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906","head_block_num":8085665,"last_irreversible_block_num":8085335,"last_irreversible_block_id":"007b5f5749c6dd4f268adc7e93597d0d6e0f8a6e2f04ec3f7b6c45e292ecac0f","head_block_id":"007b60a1e043ecee30589a74540ef241a287f16a0610b6d2fa33421adefe366a","head_block_time":"2018-07-27T19:08:14.500","head_block_producer":"eos42freedom","virtual_block_cpu_limit":200000000,"virtual_block_net_limit":1048576000,"block_cpu_limit":200000,"block_net_limit":1048576,"server_version_string":"v1.2.5"}
但是我需要它从127.0.0.1开始工作(因此我可以将其公开给来自Internet的外部呼叫)。无论如何要实现?