Skip to content

Instantly share code, notes, and snippets.

@jungopro
Created November 26, 2019 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jungopro/59fbc8dbacb7b1de53332af601012418 to your computer and use it in GitHub Desktop.
Save jungopro/59fbc8dbacb7b1de53332af601012418 to your computer and use it in GitHub Desktop.
Basic Docker script to Save a docker image as .tar file
while getopts :i:v:p opt; do
case $opt in
i) IMAGE=$OPTARG
;;
v) VERSION=$OPTARG
;;
\?) echo "Unknown option: -$OPTARG" >&2
exit 1
;;
esac
done
FILENAME=$(echo $IMAGE | tr / _)
docker pull $IMAGE:$VERSION
docker save -o $FILENAME:$VERSION.tar $IMAGE:$VERSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment