Skip to content

Instantly share code, notes, and snippets.

@xyb
Created July 2, 2020 08:06
Show Gist options
  • Save xyb/8f0777fb9f313ae84a0b566ec64eb9b9 to your computer and use it in GitHub Desktop.
Save xyb/8f0777fb9f313ae84a0b566ec64eb9b9 to your computer and use it in GitHub Desktop.
save docker image to a compressed tar ball
#!/bin/sh
image="$1"
tarfile=$(echo "$image" | sed -e 's:/:--:g' -e 's/$/.tar/')
tgzfile=$(echo "$tarfile" | sed -e 's/$/.gz/')
docker save "$image" -o "$tarfile"
gzip "$tarfile"
echo "$image" saved to "$tgzfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment