网上看了很多文章使用docker搭建eos环境,统统都是失败,比较常见的命令如下
sudo docker run --rm --name eosio -d -p 8888:8888 -p 9876:9876 -v /tmp/work:/work -v /tmp/eosio/data:/mnt/dev/data -v /tmp/eosio/config:/mnt/dev/config eosio/eos-dev:latest /bin/bash -c "nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::wallet_plugin --plugin eosio::producer_plugin --plugin eosio::history_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --plugin eosio::http_plugin -d /mnt/dev/data --config-dir /mnt/dev/config --http-server-address=0.0.0.0:8888 --access-control-allow-origin=* --contracts-console"
试过都没法用,还是eos在github上的例子有用
https://github.com/EOSIO/eos/tree/master/Docker
直接运行下面命令即可启动
docker run --name nodeos -p 8888:8888 -p 9876:9876 -t eosio/eos nodeosd.sh -e --http-alias=nodeos:8888 --http-alias=127.0.0.1:8888 --http-alias=localhost:8888 arg1 arg2
验证是否成功
curl http://localhost:8888/v1/chain/get_info
{
"server_version": "3186ddba",
"chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
"head_block_num": 91,
"last_irreversible_block_num": 90,
"last_irreversible_block_id": "0000005afdec3d59a608fadd6d60d4cdd2c5e07262a5fedc1d63515a5af0b3db",
"head_block_id": "0000005b4382fd2431064193b41c8f970adecf00e9df49e1250b9bf5eeab4e76",
"head_block_time": "2019-04-20T13:58:52.500",
"head_block_producer": "eosio",
"virtual_block_cpu_limit": 218799,
"virtual_block_net_limit": 1147328,
"block_cpu_limit": 199900,
"block_net_limit": 1048576,
"server_version_string": "v1.6.0-rc1"
}
一切ok
配置客户端命令
alias cleos='docker exec eosio /opt/eosio/bin/cleos --wallet-url http://localhost:8888'