If you setup nextcloud with docker-compose, and you find a warning with the background jobs not being executed for x days, just add this cron job to your host os.
You can replace nextcloud
with your nextcloud container name, you can check it with docker ps
*/5 * * * * docker exec -u www-data nextcloud php cron.php