change cp with tar

pull/12/head
Alexey Ukhov 2020-03-24 10:20:53 +07:00
rodzic ba21581030
commit 1e9a58a799
1 zmienionych plików z 3 dodań i 3 usunięć

6
docker_clone_volume.sh 100644 → 100755
Wyświetl plik

@ -13,7 +13,7 @@ then
exit exit
fi fi
if [ "$2" = "" ] if [ "$2" = "" ]
then then
echo "Please provide a destination volume name" echo "Please provide a destination volume name"
exit exit
@ -40,11 +40,11 @@ fi
echo "Creating destination volume \"$2\"..." echo "Creating destination volume \"$2\"..."
docker volume create --name $2 docker volume create --name $2
echo "Copying data from source volume \"$1\" to destination volume \"$2\"..." echo "Copying data from source volume \"$1\" to destination volume \"$2\"..."
docker run --rm \ docker run --rm \
-i \ -i \
-t \ -t \
-v $1:/from \ -v $1:/from \
-v $2:/to \ -v $2:/to \
alpine ash -c "cd /from ; cp -av . /to" alpine ash -c "cd /from && tar cf - . | (cd /to && tar xvf -)"