Fatal error: Allowed memory size of 2097152 bytes exhausted. Allowed memory size of 2097152 bytes exhausted this is a common error while trying to run PHP cron jobs in docker versions of nextcloud. Maybe for some other Lets focus on NextCloud.
Recently while building NAS on a laptop, I faced this issue.
A quick fix is to try to run the job from the Docker host instead of within the Docker. Just it is a workaround, not a complete solution.
/usr/bin/docker exec homecloud_app_1 su - www-data -s /bin/bash -c 'PHP_MEMORY_LIMIT=-1 php -f /var/www/html/occ files:scan --all'