eos docker运行后无法执行cleos
虽然eos给了安装教程,当然还是用docker最方便。而且现在docker还有阿里云镜像,速度快的不要不要的。
官方教程了https://github.com/EOSIO/eos/...,不过只是想运行的话,也不用build,直接在源码的Docker目录下执行:
$ docker-compose up
就好了,会自动启动两个容器:
- keosd 钱包管理组件,负责签名啊啥的
- nodeosd 区块链节点
eos更新很快,教程更新不及时,截至今天(2018-5-23),教程里cleos(命令行工具)的配置是有问题的。
Long version
# 有问题! $ alias cleos='docker-compose exec keosd /opt/eos/bin/cleos -H nodeos'
首先你可能遇到命令不存在,因为路径变过了,当前是/opt/eosio/bin/cleos
。即便是改变了路径,发现还是会报错:
Host and port options (-H, --wallet-host, etc.) have been replaced with -u/--url and --wallet-url Use for example -u http://localhost:8888 or --url https://example.invalid/
错误也说明了原因。
重新配置下发现还是报错:
# 还是有问题! $ alias cleos='docker-compose exec keosd /opt/eosio/bin/cleos -u http://localhost:8888/' $ cleos get info
Error 3130001: Missing Chain API Plugin Ensure that you have eosio::chain_api_plugin added to your node's configuration! Error Details: Chain API plugin is not enabled
这错报的真是惊天地泣鬼神,按照提示你死活是搞不对的,因为默认Chain API Plugin
是打开的。
其实是本来就不该连localhost,要连到链上去。
修改为:
$ alias cleos='docker-compose exec keosd /opt/eosio/bin/cleos -u http://nodeosd:8888/ --wallet-url http://localhost:8888' $ cleos get info { "server_version": "4e99cf47", "head_block_num": 1975, "last_irreversible_block_num": 1974, "last_irreversible_block_id": "000007b6d7f08fed622ffbf03d516e70d05d6f731cd3157cf5b0215182e0a3aa", "head_block_id": "000007b77d87993ec68eaaa3cf3752433e7a012aeffb41f9d65c2ddda5fe195c", "head_block_time": "2018-05-23T08:07:40", "head_block_producer": "eosio", "virtual_block_cpu_limit": 717591, "virtual_block_net_limit": 7553528, "block_cpu_limit": 99900, "block_net_limit": 1048576 }
好了,终于可以愉快的使用cleos了。
Short Version
$ alias cleos='docker-compose exec keosd /opt/eosio/bin/cleos -u http://nodeosd:8888/ --wallet-url http://localhost:8888'
cleos即可正常使用。
相关推荐
王道革 2020-11-25
bwyyziq 2020-11-22
pigsmall 2020-11-19
changecan 2020-11-19
helloWorldAndYou 2020-11-16
nginxs 2020-11-14
红石丶 2020-11-13
WanKaShing 2020-11-12
yangkang 2020-11-12
滴水穿石点石成金 2020-11-12
张荣珍 2020-11-12
wuxunanjing 2020-11-11
魅惑青花瓷 2020-11-11
lihongtai 2020-11-09
yangkang 2020-11-09
worldsnow 2020-11-06
MichaelJScofield 2020-11-06
TaoTaoFu 2020-11-06