Skip to content

Instantly share code, notes, and snippets.

@oanhnn
Created June 17, 2026 02:33
Show Gist options
  • Select an option

  • Save oanhnn/113b03fca0d4aab63e2b9689583e3b38 to your computer and use it in GitHub Desktop.

Select an option

Save oanhnn/113b03fca0d4aab63e2b9689583e3b38 to your computer and use it in GitHub Desktop.
Backup docker volume
#!/bin/sh
DOCKER_VOLUMN_NAME=$1
docker run --rm \
-v $DOCKER_VOLUMN_NAME:/data \
-v $(pwd):/backup \
alpine tar czf /backup/$DOCKER_VOLUMN_NAME-$(date +%Y%m%d).tar.gz -C /data .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment