Last active
August 14, 2025 09:35
-
-
Save Midnighter/84ae06e1070c0a9567be7150481eb7d1 to your computer and use it in GitHub Desktop.
Push a local Docker volume to 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.} | |
| docker run --rm -v ${volume}:/from alpine ash -c \ | |
| 'cd /from ; tar -cf - . ' | \ | |
| ssh ${host} \ | |
| "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