Created
July 15, 2025 08:39
-
-
Save seraphyn/64da93e2b7048b3cf11f583da8196221 to your computer and use it in GitHub Desktop.
Backup gitea in docker to /var/backups/GiteaBackup. docker container called gitea_prod
This file contains hidden or 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
#!/bin/bash | |
echo "Creating gitea backup inside docker containter ..." | |
docker exec -u git -it -w /tmp $(docker ps -qf "name=gitea_prod") bash -c '/app/gitea/gitea dump -c /data/gitea/conf/app.ini --file /tmp/gitea-dump.zip' | |
echo "Copying backup file from the container to the host machine ..." | |
docker cp $(docker ps -qf "name=gitea_prod"):/tmp/gitea-dump.zip /var/backups/GiteaBackup/ | |
echo "Removing backup file in container ..." | |
docker exec -u git -it -w /tmp $(docker ps -qf "name=gitea_prod") bash -c 'rm /tmp/gitea-dump.zip' | |
echo "Renaming backup file ..." | |
BACKUPFILE=gitea-dump-$(date +"%Y%m%d%H%M").zip | |
mv /var/backups/GiteaBackup/gitea-dump.zip /var/backups/GiteaBackup/$BACKUPFILE | |
echo "Backup file is available: "$BACKUPFILE | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment