Skip to content

Instantly share code, notes, and snippets.

@mikeguidry
mikeguidry / download_docker_image.sh
Last active June 14, 2019 12:14
modification of moby github's download frozen image.. allows bandwidth limit, resumes properly, and does some layer caching..
#!/usr/bin/env bash
BW=8
#using realpath = linux dependent i believe
HOMEDIR=`realpath ~`
LAYER_CACHE="${HOMEDIR}/.docker_layer_cache"
if [[ "$1" == "BW:"* ]]; then
NEWBW=`echo $1|cut -d: -f2`
if [ "$NEWBW" != "" ]; then
BW=$NEWBW
#!/bin/bash
#do we wanna limit bandwidth? pass argument BW:limit (ie: BW:10)
if [[ "$1" == "BW:"* ]]; then
NEWBW=`echo $1|cut -d: -f2`
if [ "$NEWBW" != "" ]; then
BW="--limit-rate=${NEWBW}k"
echo using bw limit ${NEWBW}
fi
shift