GNS3 Docker Images
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

create-iou-image 844B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. # create IOU docker image
  3. set -e
  4. if [ $# -lt 3 ]; then
  5. echo "Usage: create-iou-image <image> <license> <startup-config> [<private-config>]" >&2
  6. exit 1
  7. fi
  8. temp=$(mktemp -d /tmp/iou.XXXXXXXXXX)
  9. # copy image
  10. mkdir -p "$temp/data/usr/local/bin"
  11. cp -p "$1" "$temp/data/usr/local/bin/iou.bin"
  12. chmod 755 "$temp/data/usr/local/bin/iou.bin"
  13. # copy license
  14. mkdir -p "$temp/data/root"
  15. cp -p "$2" "$temp/data/root/.iourc"
  16. # copy configs
  17. mkdir -p "$temp/data/iou"
  18. cp -p "$3" "$temp/data/iou/startup-config"
  19. [ $# -ge 4 ] && cp -p "$4" "$temp/data/iou/private-config"
  20. # create Dockerfile
  21. cat > "$temp/Dockerfile" << 'EOF'
  22. FROM iou-base
  23. ADD data /
  24. VOLUME [ "/iou" ]
  25. EOF
  26. # create image
  27. image=$(basename "$1" .bin | tr -c -s 'a-zA-Z0-9.\n' - | tr A-Z a-z)
  28. echo "Creating $image"
  29. echo
  30. docker build --force-rm -t "$image" "$temp"
  31. rm -r "$temp"