Last active
April 6, 2016 13:14
-
-
Save crazygit/042d7eb4ee1be34dd5fd to your computer and use it in GitHub Desktop.
Save all docker images to tar files for copy to another machine
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
#!/usr/bin/env bash | |
#################################################################### | |
# Usage: | |
# Save all docker images to tar files for copy to another machine | |
#################################################################### | |
images=$(docker images | awk 'NR>1 && $1 != "<none>" {printf("%s:%s\n", $1, $2)}') | |
for image in $images | |
do | |
cmd="docker save -o ${image//[\/|:]/_}.tar $image" | |
echo "$cmd" | |
$cmd | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment