Manual Backups with Docker


#1

These instructions aren’t in the documentation nor the project’s source repository so I’m jotting them down here for others. How to backup Gitea and your Gitea database using Docker adapted from the High Tea README file.

Backups use the standard Gitea Backup procedure adjusted for use with Docker as follows:

  1. Shell into the Docker container:

    docker exec -it $(docker ps -qf "name=gitea") bash
    
  2. Use gitea dump the create the backup archive within the container:

    /app/gitea/gitea dump -c /data/gitea/conf/app.ini
    

    Assumes /data is a volume mapped from the container to your host’s gitea directory.

  3. Exit the shell and use docker cp to copy the archive to the host:

    docker cp $(docker ps -qf "name=gitea"):/gitea-dump-1537778440.zip .
    

If your host machine does not, itself, have a backup process in place consider moving the backup archive to a cloud storage service such as Mega or Amazon S3 for safekeeping.


High Tea: Gitea with Traefik
Upgrade Gitea Docker Compose
#2

you can also combine steps 1 and 2 thusly:

docker exec -it $(docker ps -qf "name=gitea") sh -c '/app/gitea/gitea dump -c /data/gitea/conf/app.ini'

#3

Very nice. Less is more :+1: