Manual Backups with Docker


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"):/ .

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

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'


Very nice. Less is more :+1:


Hey guys have a problem with the script. The file can’t be copied. Got the error: Error: No such container:path: cb9154fcc7c2:/

Can anybody help?


Please create a new thread and link to the above instructions if you’re using Docker and leveraging the steps within. Also note if you’re deviating from the standard Gitea backup procedures documentation in any way and provide enough code to clarify your challenge help debug your problem.


Given you are already using a bind mount e.g. for /data in your container, you could combine all steps into the following command which will write the dump into the /data folder (or any working directory inside the container that you specify with -w):

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


Is there a way to take this a step further and rsync the dump to a remote server without expanding the size of the Docker overlay?