溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

怎么獲取一個(gè)docker鏡像以及創(chuàng)建一個(gè)docker網(wǎng)絡(luò)

發(fā)布時(shí)間:2021-09-14 14:45:03 來源:億速云 閱讀:133 作者:chen 欄目:互聯(lián)網(wǎng)科技

本篇內(nèi)容介紹了“怎么獲取一個(gè)docker鏡像以及創(chuàng)建一個(gè)docker網(wǎng)絡(luò)”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

1.獲取docker鏡像

以下語句將下載包含已編譯軟件的Ubuntu鏡像。

docker pull eosio/eos

作為快速測(cè)試,運(yùn)行鏡像并獲取對(duì)bash shell的訪問權(quán)限,請(qǐng)執(zhí)行以下操作:

docker run --rm -it eosio/eos bash

如果可行,你應(yīng)該得到如下所示的提示,輸入cleos應(yīng)返回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退出鏡像。

2.創(chuàng)建一個(gè)docker網(wǎng)絡(luò)

創(chuàng)建一個(gè)docker網(wǎng)絡(luò),允許容器相互通信。

docker network create eosnetwork

3.運(yùn)行容器

運(yùn)行服務(wù)器軟件(在端口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=*"

要運(yùn)行錢包軟件(在端口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"

讓我們打開一個(gè)bash shell,以便我們可以測(cè)試一些工具。

docker run --name tools --network=eosnetwork --rm -it eosio/eos /bin/bash

4.測(cè)試下以便確定它是否全部正常工作

現(xiàn)在讓我們確保服務(wù)器正在運(yùn)行:

  • http://localhost:7777/v1/chain/get_info應(yīng)該可以在本地Web瀏覽器中使用。

  • 從工具docker實(shí)例運(yùn)行此命令應(yīng)該工作:

$ 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:
[]
[]

“怎么獲取一個(gè)docker鏡像以及創(chuàng)建一個(gè)docker網(wǎng)絡(luò)”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI