Last active
December 3, 2021 07:45
-
-
Save grawert/540c33043a04e0c5ef54202af85c1d4e to your computer and use it in GitHub Desktop.
skopeo: copy list of images to private registry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# copy image names to docker-images.txt: | |
# docker image ls --format '{{.Repository}}:{{.Tag}}' > docker-images.txt | |
TLS_VERIFY=false | |
REGISTRY=localhost:5000 | |
IMAGES_FILE="${1:-docker-images.txt}" | |
command -v skopeo &>/dev/null || { echo "skopeo is missing!"; exit 1; } | |
grep -v '^#\|^$' $IMAGES_FILE | while read -r URL; do | |
IMAGE=$(echo "$URL" | sed -E 's/^([a-z.A-Z0-9-]+)\/(.+)/\2/') | |
skopeo copy --dest-tls-verify=$TLS_VERIFY \ | |
docker://$URL \ | |
docker://$REGISTRY/$IMAGE | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment