Skip to content

Instantly share code, notes, and snippets.

@rankun203
Created April 4, 2017 01:44
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 rankun203/b507d242cd07f090cbb279a423f6f1d6 to your computer and use it in GitHub Desktop.
Save rankun203/b507d242cd07f090cbb279a423f6f1d6 to your computer and use it in GitHub Desktop.
Backup data to pwd/tar.gz from a container.
#!/usr/bin/env bash
#
# $1: backup filename.
# $2: backup target dir.
# $3: backup target volumes
if [[ "$1" = "-h" ]]
then
echo '$1: backup filename.'
echo '$2: backup target dir.'
echo '$3: backup target volumes.'
exit
fi
docker run --rm --volumes-from $3 -v $(pwd):/backup ubuntu tar cvf /backup/$1 $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment