Skip to content

Instantly share code, notes, and snippets.

@computermouth
Created May 10, 2017 21:09
Show Gist options
  • Save computermouth/4d7c9bfa0100d406e8e7d26aede8b07f to your computer and use it in GitHub Desktop.
Save computermouth/4d7c9bfa0100d406e8e7d26aede8b07f to your computer and use it in GitHub Desktop.
#!/bin/bash
# source a file of key/value that happens to be bash compliant
source ${DIRECTORY}/gadget.cfg
# get docker image size
SIZE="$(${DOCKER} images --format "{{.Size}}" ${name}_${uuid}-img)"
# get size in bytes from MB
B_SIZE=$(echo "scale=0; (1000*1000*$(echo ${SIZE} | ${SED} 's% MB%%g'))/1" | ${BC} -l)
# get transfer rate
echo " - Estimated transfer time: $(echo "scale=1; ${B_SIZE}/800000" | bc -l)s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment