Skip to content

Instantly share code, notes, and snippets.

@cinco
Last active June 23, 2020 21:56
Show Gist options
  • Save cinco/fd8422ba8830dfabd456ee17073df113 to your computer and use it in GitHub Desktop.
Save cinco/fd8422ba8830dfabd456ee17073df113 to your computer and use it in GitHub Desktop.
move volume container to another docker host
#!/bin/bash
docker run --rm -v $SOURCE_DATA_VOLUME_NAME:/from alpine ash -c "cd /from ; tar -cf - . " | ssh $TARGET_HOST 'docker run --rm -i -v $TARGET_DATA_VOLUME_NAME:/to alpine ash -c "cd /to ; tar -xpvf - " '
# before run export vars
# export SOURCE_DATA_VOLUME_NAME= && export TARGET_HOST=hostdestino && export TARGET_DATA_VOLUME_NAME=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment