Skip to content

Instantly share code, notes, and snippets.

@mrtnvgr
Last active June 28, 2023 09:52
Show Gist options
  • Save mrtnvgr/1645cadbc21f97c305b70efb388bae2f to your computer and use it in GitHub Desktop.
Save mrtnvgr/1645cadbc21f97c305b70efb388bae2f to your computer and use it in GitHub Desktop.
Backup Docker volumes
#!/bin/sh
for VOLUME in $@; do
docker volume inspect $VOLUME >/dev/null && \
docker run --rm -v $VOLUME:/_data -v $PWD:/backup busybox tar czf backup/$VOLUME.tar.gz _data && \
echo "OK: $VOLUME"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment