EOS docker開發環境
EOS Wiki提供了有關如何使用docker容器編譯最新版本程式碼的說明。但可能有它自己的一些問題,因此我們鼓勵你在學習時引用下面映象。這樣最初會更容易,更快。
如果你還沒有安裝docker,請在此處下載。
1.獲取docker映象
以下語句將下載包含已編譯軟體的Ubuntu映象。
docker pull eosio/eos
作為快速測試,執行映象並獲取對bash shell的訪問許可權,請執行以下操作:
docker run --rm -it eosio/eos bash
如果可行,你應該得到如下所示的提示,輸入cleos應返回cleos工具的幫助:
ERROR: RequiredError: Subcommand required
Command Line Interface to EOSIO Client
Usage: cleos [OPTIONS] SUBCOMMAND
Options:
-h,--help Print this help message and exit
-u,--url TEXT=http://localhost:8888/
the http/https URL where nodeos is running
--wallet-url TEXT=http://localhost:8888/
the http/https URL where keosd is running
-v,--verbose output verbose actions on error
Subcommands:
version Retrieve version information
create Create various items, on and off the blockchain
get Retrieve various items and information from the blockchain
set Set or update blockchain state
transfer Transfer EOS from account to account
net Interact with local p2p network connections
wallet Interact with local wallet
sign Sign a transaction
push Push arbitrary transactions to the blockchain
multisig Multisig contract commands
system Send eosio.system contract action to the blockchain.
[email protected]:/#exit
鍵入exit退出映象。
2.建立一個docker網路
建立一個docker網路,允許容器相互通訊。
docker network create eosnetwork
3.執行容器
執行伺服器軟體(在埠7777上):
docker run --name server --network=eosnetwork --rm -p 7777:7777 -i eosio/eos /bin/bash -c "nodeos -e -p eosio --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin -d /mnt/dev/data --http-server-address=0.0.0.0:7777 --access-control-allow-origin=*"
要執行錢包軟體(在埠5555上):
docker run --name wallet --network=eosnetwork --rm -p 5555:5555 -i eosio/eos /bin/bash -c "keosd --http-server-address=0.0.0.0:5555"
讓我們開啟一個bash shell,以便我們可以測試一些工具。
docker run --name tools --network=eosnetwork --rm -it eosio/eos /bin/bash
4.測試下以便確定它是否全部正常工作
現在讓我們確保伺服器正在執行:
http://localhost:7777/v1/chain/get_info應該可以在本地Web瀏覽器中使用。
從工具docker例項執行此命令應該工作:
$ cleos -u http://www.gcyl152.com server:7777 get info
# Expected response
{
"server_version": "749a6759",
"head_block_num": 1953,
"last_irreversible_block_num"www.wanmeiyuele.cn: 1952,
"last_irreversible_block_id": "000007a0c1ae4e28480dcbeef36e9d4970987969f850453dcf8e244b569d6325",
"head_block_id": "000007a1fc0d5b3dd16ebfe18ab9a288ac8bc7d03caee050a58a502577d25560",
"head_block_time": "2018-05-16T02:04:08",
"head_block_producer": "eosio",
"virtual_block_cpu_limit": 701979,
"virtual_block_net_limit"www.michenggw.com/: 7389096,
"block_cpu_limit": 99900,
"block_net_limit": 1048576
}
$ cleos --wallet-url http://www.yongshiyule178.com wallet:5555 wallet list keys
# We have not created any wallets yet, so this is the expected response
Wallets: