download-dockerimages.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash -eu
  2. ##################################################
  3. # This script pulls docker images from hyperledger
  4. # docker hub repository and Tag it as
  5. # hyperledger/fabric-<image> latest tag
  6. ##################################################
  7. dockerFabricPull() {
  8. local FABRIC_TAG=$1
  9. for IMAGES in peer orderer couchdb ccenv javaenv kafka zookeeper; do
  10. echo "==> FABRIC IMAGE: $IMAGES"
  11. echo
  12. docker pull hyperledger/fabric-$IMAGES:$FABRIC_TAG
  13. docker tag hyperledger/fabric-$IMAGES:$FABRIC_TAG hyperledger/fabric-$IMAGES
  14. done
  15. }
  16. dockerCaPull() {
  17. local CA_TAG=$1
  18. echo "==> FABRIC CA IMAGE"
  19. echo
  20. docker pull hyperledger/fabric-ca:$CA_TAG
  21. docker tag hyperledger/fabric-ca:$CA_TAG hyperledger/fabric-ca
  22. }
  23. usage() {
  24. echo "Description "
  25. echo
  26. echo "Pulls docker images from hyperledger dockerhub repository"
  27. echo "tag as hyperledger/fabric-<image>:latest"
  28. echo
  29. echo "USAGE: "
  30. echo
  31. echo "./download-dockerimages.sh [-c <fabric-ca tag>] [-f <fabric tag>]"
  32. echo " -c fabric-ca docker image tag"
  33. echo " -f fabric docker image tag"
  34. echo
  35. echo
  36. echo "EXAMPLE:"
  37. echo "./download-dockerimages.sh -c x86_64-1.0.0-alpha -f x86_64-1.0.0-alpha"
  38. echo
  39. echo "By default, pulls fabric-ca and fabric 1.0.0-alpha docker images"
  40. echo "from hyperledger dockerhub"
  41. exit 0
  42. }
  43. while getopts "\?hc:f:" opt; do
  44. case "$opt" in
  45. c) CA_TAG="$OPTARG"
  46. echo "Pull CA IMAGES"
  47. ;;
  48. f) FABRIC_TAG="$OPTARG"
  49. echo "Pull FABRIC TAG"
  50. ;;
  51. \?|h) usage
  52. echo "Print Usage"
  53. ;;
  54. esac
  55. done
  56. : ${CA_TAG:="x86_64-1.0.0-alpha"}
  57. : ${FABRIC_TAG:="x86_64-1.0.0-alpha"}
  58. echo "===> Pulling fabric Images"
  59. dockerFabricPull ${FABRIC_TAG}
  60. echo "===> Pulling fabric ca Image"
  61. dockerCaPull ${CA_TAG}
  62. echo
  63. echo "===> List out hyperledger docker images"
  64. docker images | grep hyperledger*