19 lines
421 B
Bash
19 lines
421 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
set -e -o pipefail
|
||
|
|
||
|
info() {
|
||
|
[ "$#" -gt 0 ] && echo -e "\033[1m>>> $*\033[0m" >&2
|
||
|
}
|
||
|
|
||
|
readarray -t volumes < <(docker volume ls --format "{{ .Name }}")
|
||
|
|
||
|
for v in "${volumes[@]}"; do
|
||
|
info "Dumping \"$v\""
|
||
|
docker run --rm -v "$v":/vol:ro localhost/archiver sh -c \
|
||
|
"bsdtar -C /vol --numeric-owner -c . | zstdmt -15v" \
|
||
|
> "$v".tar.zst
|
||
|
|
||
|
docker volume inspect "$v" > "$v".json
|
||
|
done
|