Skip to content

Instantly share code, notes, and snippets.

@qwadro
Last active April 11, 2022 09:22
Show Gist options
  • Save qwadro/f59baf62fc7aff6eb8e738b8af636211 to your computer and use it in GitHub Desktop.
Save qwadro/f59baf62fc7aff6eb8e738b8af636211 to your computer and use it in GitHub Desktop.
save docker images as separated files
for a in $(docker images | awk '{ print $1 "?" $2 }' | grep -v REPOSITORY )
do
name=$(echo $a | cut -d? -f1)
version=$(echo $a | cut -d? -f2)
shortname=${name##*/}
echo exporting docker image: $name with version $version
docker save $name:$version | gzip > "$shortname"_"$version".tar.gz
echo $shortname=$version >> ../versions.txt
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment