Skip to content

Instantly share code, notes, and snippets.

@j796160836
Last active December 27, 2023 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j796160836/82a22d1a4077174d109c6b75c9ca4c85 to your computer and use it in GitHub Desktop.
Save j796160836/82a22d1a4077174d109c6b75c9ca4c85 to your computer and use it in GitHub Desktop.
download all docker images from list
#!/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."
# 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