请在宿主机自行安装docker、docker-compose与git环境
1.docker拉取最新fabric镜像
docker pull hyperledger/fabric-orderer
docker pull hyperledger/fabric-peer
docker pull hyperledger/fabric-ccenv
docker pull hyperledger/fabric-tools
docker pull hyperledger/fabric-couchdb
2.基于fabric-tools镜像启动cli容器 从容器中拷贝可执行文件到本地
docker run -d --name cli hyperledger/fabric-tools sleep 1h(sleep 1h使容器处于运行状态)
docker cp cli:/usr/local/bin/cryptogen /usr/local/bin/cryptogen
docker cp cli:/usr/local/bin/configtxgen /usr/local/bin/configtxgen
docker cp cli:/usr/local/bin/configtxlator /usr/local/bin/configtxlator
docker rm -f cli
cryptogen --help可显示命令帮助
3.运行first-network
cd ~
git clone https://github.com/hyperledger/fabric-samples.git
cd fabric-samples/first-network
./byfn.sh up
成功截图
success.jpg
在阿里云环境下此处可能不成功,则更改first-network下如下配置文件,增加GODEBUG=netdns=go环境变量 :
1.base/docker-compose-base.yaml
orderer.jpeg
2.base/peer-base.yaml
peer-base.jpeg
3.docker-compose-cli.yaml
cli.jpeg
重新启动命令:./byfn.sh restart
网友评论