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

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