Last active
August 14, 2025 09:34
-
-
Save Midnighter/8948f63f8788abe08932913ecbfffcbb to your computer and use it in GitHub Desktop.
Pull a specific Docker volume from a remote host 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
#!/usr/bin/env bash | |
set -euxo pipefail | |
host=${1?The first argument needs to be an SSH remote host.} | |
volume=${2?The second argument needs to be a Docker volume name.} | |
ssh ${host} \ | |
"docker run --rm -v ${volume}:/from alpine ash -c 'cd /from ; tar -cf - . '" | \ | |
docker run --rm -i -v ${volume}:/to alpine ash -c 'cd /to ; tar -xpvf - ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment