# How to backup a Nextcloud-installation (+MariaDB and Letsencrypt) with Docker

**URL:** <https://help.nextcloud.com/t/how-to-backup-a-nextcloud-installation-mariadb-and-letsencrypt-with-docker/65273>\
**Category:** ℹ️ Support\
**Tags:** docker, backup, openmediavault\
**Created:** [November 29, 2019, 2:50pm UTC](https://help.nextcloud.com/t/how-to-backup-a-nextcloud-installation-mariadb-and-letsencrypt-with-docker/65273 "2019-11-29T14:50:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Reiner\_Nippes](https://help.nextcloud.com/user_avatar/help.nextcloud.com/reiner_nippes/32/9479_2.png) [@Reiner\_Nippes](https://help.nextcloud.com/u/Reiner_Nippes)\
**Post date:** [November 29, 2019, 3:13pm UTC](https://help.nextcloud.com/t/how-to-backup-a-nextcloud-installation-mariadb-and-letsencrypt-with-docker/65273/2 "2019-11-29T15:13:24Z")

</div>

You don’t need to sudo in the bash command. `docker exec -u www-data nextcloud php occ ...` will do the job.

You have to create a cronjob for root or any user on your host that can run docker commands to call your backup script. `crontab -e`  
The cron syntax you’ll find on Google.

You forgot config.php . Or?

And you may have a look at

> [@Rsync to cloud storage for backups?](https://help.nextcloud.com/t/rsync-to-cloud-storage-for-backups/43574/2):
>
> yes. to make it better you can combine it with restic. restic takes care about the lifecycle of your backups since it is backup program, encrypts the files again, can use rclone as a target repo and is cool. wink[https://restic.readthedocs.io/en/latest/010\_introduction.html](https://restic.readthedocs.io/en/latest/010_introduction.html) An example script: #!/bin/bash export RESTIC\_REPOSITORY="/var/nc-backup" export RESTIC\_PASSWORD="EAtcVlENiC6TlMwH73X9PRfD17vsEEHI" # abort entire script if any command fails set -e # Make sure nextcloud is enabled wh…

---

_[View the full topic](https://help.nextcloud.com/t/how-to-backup-a-nextcloud-installation-mariadb-and-letsencrypt-with-docker/65273)._
