Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #!/bin/sh
  2. 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