Dockerized NC, cron is not working

I’m running a dockerized nextcloud instance with the docker-compose adopted from here:

My (limited!) sysadm knowledge is a bit dated since i was trained when Ubuntu was on 16.04 and i am new to docker. I followed this tutorial for the nextcloud setup: [www.youtube.com/watch?v=pO9YOoUOrUs]

Other than that i only did some basic server hardening (installing fail2ban, locking down ssh, the usual) on a fresh v-server instance (Strato). The container is running for 3 months now an I did not have any problems during the first few weeks. The update from 20.0.3 to 20.0.4 went fine.

Nextcloud currently running V 20.0.4
Host system: Ubuntu Server 18.4 LTS
PHP: 7.4.12
Apache: 2.4
Mariadb: 10.5.8
NGinx Proxy: 1.19.3

The issue you are facing:

Now i have a ton of issues concerning file synchronization and shared folders, edited files being overwritten by older versions of the file, files being corrupted, not being able to rename or move or download files and more, resulting in tons of error messages like:

  • Fatal webdav Sabre\DAV\Exception\ServiceUnavailable: Could not open file

  • Error PHP Error: fopen(FILEPATH): failed to open stream: No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#355

It’s “Nextcloud 2077” guys. But before i get into that in another topic i’m trying to fix the issue that cron is not executing cron.php; I suppose thats were my other problems originate.

I have to rely on AJAX which isn’t running at night when no one is using the cloud. Even with the desktop client installed for 2 different users for a while everything went fine though. After a while desktop synchronization began to throw errors.

After reading this (Cron doesn't execute cron.php) i made sure that the container and host have the same timezone settings.

If i run “sudo docker exec -u www-data -t -i CONTAINER-ID php /var/www/html/cron.php” i can execute the cron.php from the host. The command requires sudo privileges to run.

But adding a cronjob either via “sudo crontab -e” or “sudo crontab -e -u www-data” with different syntaxes doesn’t seem to work

I am aware, that inside the container at “/var/spool/cron/crontabs” is a file called www-data that

has “*/5 * * * * php -f var www/html/cron.php” written in it. But inside the container no process labeled “cron” seems to be running (checked with top). It is running on the host though and cron jobs executed on the host are logged in the syslog.

Config.php:

use the host cronjob with docker exec ....