Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Save all docker images to tar files for copy to another machine
#!/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
You can’t perform that action at this time.