在搭建Fabric 1.0 開發(fā)環(huán)境時(shí)官方文檔:http://hyperledger-fabric.readthedocs.io/en/latest/samples.html#binaries 介紹使用如下命令下載Fabric平臺相關(guān)的可執(zhí)行文件和docker鏡像:
curl -sSL https://goo.gl/Gci9ZX | bash
但是基本上都會(huì)遇到下面的錯(cuò)誤:
curl: (7) Failed to connect to goo.gl port 443: Connection timed out
這個(gè)問題google了也未必能解決,網(wǎng)上的說法一大堆,有的說是ipv6導(dǎo)致,有的說是防火墻導(dǎo)致。。。
如果是Fabric,我這里推薦一種做法,無意間發(fā)現(xiàn)的,沒想到竟然有效果:
step1
在瀏覽器中打開命令curl -sSL https://goo.gl/Gci9ZX | bash中的這個(gè)鏈接https://goo.gl/Gci9ZX(需要翻墻),然后你可以看到這其實(shí)就是一個(gè)shell腳本,內(nèi)容如下:
#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
export VERSION=1.0.2
export ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}')
#Set MARCH variable i.e ppc64le,s390x,x86_64,i386
MARCH=`uname -m`
dockerFabricPull() {
local FABRIC_TAG=$1
for IMAGES in peer orderer couchdb ccenv javaenv kafka zookeeper tools; do
echo "==> FABRIC IMAGE: $IMAGES"
echo
docker pull hyperledger/fabric-$IMAGES:$FABRIC_TAG
docker tag hyperledger/fabric-$IMAGES:$FABRIC_TAG hyperledger/fabric-$IMAGES
done
}
dockerCaPull() {
local CA_TAG=$1
echo "==> FABRIC CA IMAGE"
echo
docker pull hyperledger/fabric-ca:$CA_TAG
docker tag hyperledger/fabric-ca:$CA_TAG hyperledger/fabric-ca
}
: ${CA_TAG:="$MARCH-$VERSION"}
: ${FABRIC_TAG:="$MARCH-$VERSION"}
echo "===> Downloading platform binaries"
curl https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${VERSION}/hyperledger-fabric-${ARCH}-${VERSION}.tar.gz | tar xz
echo "===> Pulling fabric Images"
dockerFabricPull ${FABRIC_TAG}
echo "===> Pulling fabric ca Image"
dockerCaPull ${CA_TAG}
echo
echo "===> List out hyperledger docker images"
docker images | grep hyperledger*
腳本也就主要做了兩件事:下載平臺相關(guān)可執(zhí)行文件和下載fabric docker鏡像。
step2
在你的本地目錄新建download.sh(名字隨便起),將網(wǎng)頁上的內(nèi)容復(fù)制到文件里,然后保存退出執(zhí)行以下命令:
chmod a+x download.sh
然后執(zhí)行命令:
./download.sh
你可以看到已經(jīng)開始下載了!
PS:這里第一階段下載平臺相關(guān)執(zhí)行文件可以翻墻要快一些,然后當(dāng)開始下載docker鏡像時(shí)關(guān)掉代理。為了使docker下載快一點(diǎn),記得配置docker加速器!
版權(quán)所有,轉(zhuǎn)載請注明出處。