pull/16/head
AlcibiadesCleinias 2021-03-08 02:06:22 +03:00
rodzic 73a5ca8c31
commit c9732a9418
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 1E322823057CFC1A
1 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash
#Author: Guido Diepen # The script repeates docker_clone_volume.sh
# Thanks to maddin25 who provides solution in
# https://stackoverflow.com/questions/42973347/how-to-copy-docker-volume-from-one-machine-to-another
#Convenience script that can help me to easily create a clone of a given # The script is mainly useful if you are using named volumes and
#data volume. The script is mainly useful if you are using named volumes # on both hosts you should have running docker diemon
# and have access to root, obviously.
# On both hosts you should have running docker diemon
# and have access to root obviously.
# arg: $1: source volume name # arg: $1: source volume name
# arg: $2: target host # arg: $2: target host
@ -52,6 +52,6 @@ fi
docker run --rm \ docker run --rm \
-v $1:/from alpine ash -c \ -v $1:/from alpine ash -c \
"cd /from ; tar -cf - . " | \ "cd /from ; tar -cfz - . " | \
ssh $2 \ ssh $2 \
"docker run --rm -i -v \"$3\":/to alpine ash -c 'cd /to ; tar -xpvf - '" "docker run --rm -i -v \"$3\":/to alpine ash -c 'cd /to ; tar -xpvfz - '"