docker-compose-files/hyperledger/1.0.1/e2e_cli/download-dockerimages.sh

82 lines
2.1 KiB
Bash
Raw Normal View History

2017-09-01 20:09:18 +08:00
#!/bin/bash -eu
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
##################################################
# This script pulls docker images from hyperledger
# docker hub repository and Tag it as
# hyperledger/fabric-<image> latest tag
##################################################
#Set ARCH variable i.e ppc64le,s390x,x86_64,i386
ARCH=`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
}
usage() {
echo "Description "
echo
echo "Pulls docker images from hyperledger dockerhub repository"
echo "tag as hyperledger/fabric-<image>:latest"
echo
echo "USAGE: "
echo
echo "./download-dockerimages.sh [-c <fabric-ca tag>] [-f <fabric tag>]"
echo " -c fabric-ca docker image tag"
echo " -f fabric docker image tag"
echo
echo
echo "EXAMPLE:"
echo "./download-dockerimages.sh -c x86_64-1.0.0-beta -f x86_64-1.0.0-beta"
echo
echo "By default, pulls fabric-ca and fabric 1.0.0-beta docker images"
echo "from hyperledger dockerhub"
exit 0
}
while getopts "\?hc:f:" opt; do
case "$opt" in
c) CA_TAG="$OPTARG"
echo "Pull CA IMAGES"
;;
f) FABRIC_TAG="$OPTARG"
echo "Pull FABRIC TAG"
;;
\?|h) usage
echo "Print Usage"
;;
esac
done
: ${CA_TAG:="$ARCH-1.0.0-beta"}
: ${FABRIC_TAG:="$ARCH-1.0.0-beta"}
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*