summaryrefslogtreecommitdiff
path: root/docker_tools/docker_restore_vol.sh
diff options
context:
space:
mode:
Diffstat (limited to 'docker_tools/docker_restore_vol.sh')
-rwxr-xr-xdocker_tools/docker_restore_vol.sh31
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