Skip to content

Instantly share code, notes, and snippets.

@jrenggli
Created December 8, 2015 17:56
Show Gist options
  • Save jrenggli/dc98b8b27584f7abe466 to your computer and use it in GitHub Desktop.
Save jrenggli/dc98b8b27584f7abe466 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
@jrenggli
Copy link
Author

jrenggli commented Dec 8, 2015

This script uses pigz (http://zlib.net/pigz/), the multi-processor version of gzip. Of course you can use simple gzip instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment