RSS

Migrate a data volume

How to migrate a data volume

Here is how to migrate a data volume between two of your hosts. A rsync of the proper /var/lib/docker/volumes subfolder would work just as well, but is here a fun way to do it with docker and pipes :

export VOLUME=tiddlywiki
export DEST=10.1.0.242
docker run --rm -v $VOLUME:/from alpine ash -c "cd /from ; tar -cpf - . " \
| ssh $DEST "docker run --rm -i -v $VOLUME:/to alpine ash -c 'cd /to ; tar -xfp - ' "