Skip to content

Instantly share code, notes, and snippets.

@aharonh
Forked from jrenggli/backup-all-docker-images.sh
Created February 17, 2018 14:04
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 aharonh/328426c0380fd9a5a7476c1a3e22c02f to your computer and use it in GitHub Desktop.
Save aharonh/328426c0380fd9a5a7476c1a3e22c02f to your computer and use it in GitHub Desktop.
Backup/Save all Docker Images to a compressed file
docker images | tail -n +2 | grep -v "none" | awk '{printf("%s:%s\n", $1, $2)}' | while read IMAGE; do
echo $IMAGE
filename="${IMAGE//\//-}"
filename="${filename//:/-}.docker-image.gz"
docker save ${IMAGE} | pigz --stdout --best > $filename
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment