Cron job cannot execute due to invalid data directory

I’m using a docker container for nextcloud, and when I view the system overview (from settings → overview) I see the following error:

It was not possible to execute the cron job via CLI. The following technical errors have appeared:
Your data directory is invalid Ensure there is a file called “.ocdata” in the root of the data directory.
Cannot create “data” directory This can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/18/go.php?to=admin-dir_permissions

My data directory should be fine, I have it mounted in docker-compose with

volumes:
- data:/var/www/html/data

the permissions should be fine as well

$ ls -ld /var/www/html/data/
drwxrwx--- 7 www-data root 4096 Jan 28 17:04 /var/www/html/data/

$ ls -lA /var/www/html/data/.ocdata
-rw-r--r-- 1 www-data www-data 0 Jan 28 17:04 /var/www/html/data/.ocdata

my datadirectory is configured for this folder as well

'datadirectory' => '/var/www/html/data',

What else do I need to check for this, or is this an invalid error?