diff options
| author | Miguel <m.i@gmx.at> | 2019-05-12 12:56:45 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2019-05-12 12:56:45 +0200 |
| commit | 3ccd1cf7427768cb390527a45753e0cc32f4d609 (patch) | |
| tree | 4f1c229f55b95a7b58f316cd4a92bfa759a6389c /docker_tools/docker_restore_vol.sh | |
| parent | f1fa025404314863878546405edea0e18ff9151a (diff) | |
added docker tools
Diffstat (limited to 'docker_tools/docker_restore_vol.sh')
| -rwxr-xr-x | docker_tools/docker_restore_vol.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/docker_tools/docker_restore_vol.sh b/docker_tools/docker_restore_vol.sh new file mode 100755 index 0000000..5be6a12 --- /dev/null +++ b/docker_tools/docker_restore_vol.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Please read the README.md distributed along this script + +if [ "$#" -ne 2 ]; then + + echo "" + echo "-----------------------------------------" + echo "Usage: $0 [source-archive] [target-volume]" + echo "" + echo "This will un-tar the [source-archive] to a NEW docker [target-volume]" + echo "-----------------------------------------" + echo "" + + exit +fi + +echo resotring archive: $1 to data-volume $2 + +VOLS=`docker volume ls --format '{{.Name}}'` + +for v in $VOLS; do + + if [ "$v" == "$2" ]; then + echo "volume $v already exists! Bailing out..." + exit + fi + +done + +docker run --rm -it -v `pwd`:/IN -v $2:/OUT bash tar -C /OUT -xf /IN/$1 |
