#!/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