Skip to content

Instantly share code, notes, and snippets.

@iggyvolz
Last active July 16, 2020 01:25
Show Gist options
  • Save iggyvolz/71ab0c3cf8d8716ab37ee201d2e5c073 to your computer and use it in GitHub Desktop.
Save iggyvolz/71ab0c3cf8d8716ab37ee201d2e5c073 to your computer and use it in GitHub Desktop.
# Run the registry with:
# docker run -d -p 5000:5000 registry
DOCKER="127.0.0.1:5000"
test "`curl -sS $DOCKER/v2/`" == "{}" || { echo "Docker registry not found on $DOCKER"; echo "Try running it with docker run -d -p 5000:5000 registry"; exit 1; }
get() {
echo "Getting $1"
mkdir -p `dirname $1`
curl -Ss http://$DOCKER/$1 > $1
}
rm -Rf v2
mkdir v2
echo '{}' > v2/index.html
for file in *.Dockerfile; do
project=${file%.*}
docker build -t $DOCKER/$project -f $file .
docker push $DOCKER/$project
get v2/$project/manifests/latest
NUM_BLOBS=`jq '.fsLayers | length' <v2/$project/manifests/latest`
for ((i=0;i<$NUM_BLOBS;i++)); do
# Download blob $i
BLOB=`jq -r ".fsLayers[$i].blobSum" <v2/$project/manifests/latest`
get v2/$project/blobs/$BLOB
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment