使用eos docker鏡像是部署本地EOS開發環境的最輕鬆愉快的方法。使用官方提供的eos docker鏡像,你能夠快速創建一個eos開發環境,能夠迅速啓動開發節點和錢包服務器、建立帳戶、編寫智能合約...node
若是要學習EOS應用開發,能夠訪問這個【EOS智能合約與DApp開發教程】,教程內容涵蓋EOS工具鏈、帳戶與錢包、發行代幣、智能合約開發、部署與交互等核心知識點,最後綜合運用各知識點完成一個便籤DApp的開發。docker
EOS Wiki提供了有關如何使用docker容器編譯最新版本代碼的說明。但可能有它本身的一些問題,所以咱們鼓勵你在學習時引用下面鏡像。這樣最初會更容易,更快。shell
若是你尚未安裝docker,請在此處下載。api
如下語句將下載包含已編譯軟件的Ubuntu鏡像。瀏覽器
docker pull eosio/eos
做爲快速測試,運行鏡像並獲取對bash shell的訪問權限,請執行如下操做:bash
docker run --rm -it eosio/eos bash
若是可行,你應該獲得以下所示的提示,輸入cleos
應返回cleos工具的幫助:服務器
root@a5f9eafaab74:/#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. root@a5f9eafaab74:/# root@a5f9eafaab74:/#exit
鍵入exit
退出鏡像。網絡
建立一個docker網絡,容許容器相互通訊。工具
docker network create eosnetwork
運行服務器軟件(在端口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
如今讓咱們確保服務器正在運行:
$ cleos -u http://server:7777 get info # Expected response { "server_version": "749a6759", "head_block_num": 1953, "last_irreversible_block_num": 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": 7389096, "block_cpu_limit": 99900, "block_net_limit": 1048576 }
$ cleos --wallet-url http://wallet:5555 wallet list keys # We have not created any wallets yet, so this is the expected response Wallets: [] []
原文連接:使用docker學習EOS