Forked from jcataluna/gist:1dc2f31694a1c301ab34dac9ccb385ea
Created
September 10, 2024 19:26
-
-
Save day253/a4d508dd7fa65fd45e1ac04373fb2601 to your computer and use it in GitHub Desktop.
Script to save all images from a docker-compose.yml file
This file contains hidden or 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 | |
| mkdir -p out | |
| for img in `grep image $1| sed -e 's/^.*image\: //g'`; | |
| do | |
| cleanname=${img/\//-} | |
| tag=`docker images | grep $img | awk '{print $2}'` | |
| echo "Exporting image: $img, tag:$tag ($cleanname)..." | |
| docker save $img -o out/$cleanname.tar | |
| ls -lah out/$cleanname.tar | |
| tar -czvf out/$cleanname.tgz out/$cleanname.tar | |
| rm -rf out/$cleanname.tar | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment