Created
March 8, 2021 15:13
-
-
Save bkyle/56edda7f07e5b48ec1b98ad61fcace1b to your computer and use it in GitHub Desktop.
Backup the contents of docker images
This file contains 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
container="" | |
bindings=$(docker inspect ${container} | jq -r '.[].HostConfig.Binds[]') | |
echo ${bindings} | while read bind; do | |
volume=${bind/:*/} | |
mount_point=${bind/*:/} | |
echo "docker run --volumes-from ${CONTAINER} -it --rm -v $(pwd)/backups:/backups busybox tar -czvf /backups/${volume}.tar.gz \"${mount_point}\"" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment