Last active
October 1, 2024 01:58
-
-
Save j796160836/82a22d1a4077174d109c6b75c9ca4c85 to your computer and use it in GitHub Desktop.
download all docker images from list
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 | |
docker_images=( | |
"nginx:latest" | |
) | |
for image in "${docker_images[@]}"; do | |
echo "Downloading $image ..." | |
echo | |
image_name=${image##*/} | |
image_name=${image_name//:/_} | |
docker pull --platform linux/amd64 "$image" | |
echo | |
echo "Saving image_${image_name}.tar.gz ..." | |
docker save "$image" | gzip > "image_${image_name}.tar.gz" | |
done | |
echo "Done." |
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 | |
image=$1 | |
if [ -z "$1" ]; then | |
echo "Download docker image utility" | |
echo | |
echo "Usage: $0 <image>" | |
exit 1 | |
fi | |
echo "Downloading $image ..." | |
echo | |
image_name=${image##*/} | |
image_name=${image_name//:/_} | |
docker pull --platform linux/amd64 "$image" | |
echo | |
echo "Saving image_${image_name}.tar.gz ..." | |
docker save "$image" | gzip > "image_${image_name}.tar.gz" | |
echo "Done." |
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 | |
docker image ls --format "./download_one_image.sh {{.Repository}}:{{.Tag}}" |
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 | |
# list dir and load images | |
for i in `ls`; do | |
echo "Load $i ..." | |
docker load -i $i | |
done | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment