Skip to content

Instantly share code, notes, and snippets.

@PauloLuan
Forked from jrenggli/backup-all-docker-images.sh
Created December 10, 2018 15:33
Show Gist options
  • Save PauloLuan/655dde890f5bc1bc0209fd6175de299d to your computer and use it in GitHub Desktop.
Save PauloLuan/655dde890f5bc1bc0209fd6175de299d 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
@PauloLuan
Copy link
Author

Pra subir depois:

docker load -i /root/container1.tar
docker images

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