Created
January 10, 2017 10:37
-
-
Save jaybuidl/24c480677a0fec29ba0a9c1c9278ea4a to your computer and use it in GitHub Desktop.
Copies all the local docker data volumes to a new machine via ssh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/!bin/bash | |
[ $# -lt 1 ] && echo "usage: $(basename $0) <target_ssh_user@target_ssh_hostname>" && exit 1; | |
target="$1" | |
docker pull alpine | |
for volume in $(docker volume ls -q) | |
do | |
docker run --rm -v $volume:/from alpine ash -c "cd /from ; tar -cf - . " \ | |
ssh $target 'docker run --rm -i -v '$volume':/to alpine ash -c "cd /to ; tar -xvf - " ' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment