Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- backupdir=/backup ; for c in $(docker ps -q) ; do docker inspect -f '{{range $v, $rw := .VolumesRW }} {{if eq $rw true}} {{$.Name}} {{$v}} {{index $.Volumes $v}} {{end}} {{"\x0A"}} {{end}}' $c ; done | grep -v '^\s*$' | awk '{ print $1, $2, $3 }' | while read cont vol loc ; do mkdir -p $(dirname /$backupdir/$cont/$vol) ; cp -ax $loc /$backupdir/$cont/$vol ; done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement