• fabric镜像安装脚本分析


    #!/bin/bash
    #
    # Copyright IBM Corp. All Rights Reserved.
    #
    # SPDX-License-Identifier: Apache-2.0
    #
    
    export VERSION=1.0.0-beta
    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 tools zookeeper; 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/fabric-binary/${ARCH}-${VERSION}/fabric-binary-${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*
    VERSION:将要安装的fabric的版本
    ARCH:取得操作系统类型,例如linux-amd64
    MARCH:取得操作系统位数


    下载相关的脚本,与镜像本身没有关系
    curl https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/fabric-binary/${ARCH}-${VERSION}/fabric-binary-${ARCH}-${VERSION}.tar.gz | tar xz
    调用dockerFabricPull函数下载镜像,镜像包括:
    peer orderer couchdb ccenv javaenv kafka tools zookeeper
    docker pull hyperledger/fabric-$IMAGES:$FABRIC_TAG
    docker tag hyperledger/fabric-$IMAGES:$FABRIC_TAG hyperledger/fabric-$IMAGES

          docker pull  镜像名:版本    (pull下载,会从镜像库自动下载镜像到本机)

          docker tag   镜像名:版本  镜像名    (tag重命名,如果不给版本号的话,会当作latest版本,后续使用的时候,也不用加版本号了)


    调用
    dockerCaPull函数下载ca镜像。过程同上。

    docker images 显示现有的所有镜像

  • 相关阅读:
    1.1 HTML5简介
    MATLAB基础知识——1.1MATLAB系统变量
    初识MATLAB
    Z-Stack
    [C语言]关于struct和typedef struct
    [Zigbee]定时器1
    常用数论算法
    SPFA&邻接表 PASCAL
    kruskal算法-Pascal
    懒惰的JY--关于遍历
  • 原文地址:https://www.cnblogs.com/maobuji/p/7092749.html
Copyright © 2020-2023  润新知