本篇内容介绍了“怎么获取一个docker镜像以及创建一个docker网络”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
以下语句将下载包含已编译软件的Ubuntu镜像。
docker pull eosio/eos
作为快速测试,运行镜像并获取对bash shell的访问权限,请执行以下操作:
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
现在让我们确保服务器正在运行:
http://localhost:7777/v1/chain/get_info应该可以在本地Web浏览器中使用。
从工具docker实例运行此命令应该工作:
$ 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镜像以及创建一个docker网络”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。