Skip to content

Instantly share code, notes, and snippets.

@costa
Created January 28, 2026 14:23
Show Gist options
  • Select an option

  • Save costa/805b85bb00516c54cf9517f3cec49af9 to your computer and use it in GitHub Desktop.

Select an option

Save costa/805b85bb00516c54cf9517f3cec49af9 to your computer and use it in GitHub Desktop.
Clone a docker volume for fun and profit (stopping attached containers, if needed for data integrity, is on you)
#!/bin/bash -e
test "$#" -ne 2 && echo "USAGE ...docker-volume-clone <OLD> <NEW>" >&2 && exit 145
cd "$( dirname "${BASH_SOURCE[0]}" )"/..
docker volume create --name "$2"
docker run --rm -v "$1:/from" -v "$2:/to" eeacms/rsync rsync -a /from/ /to/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment