Cron not running due to "missing .ocdata file"

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.
Your data directory is not writable Permissions can usually be fixed by giving the webserver write access to the root directory. See

The file exists, and the permissions is set as told in

If the mentioned error message is shown Nextcloud has difficulties to access the directory, independently from what you believe you’ve done. So to start investigating further I would ask you to provide detailed information about your installation environment, software versions.

Additionally please show the output of this command:

grep "datadirectory" /full-path-to-the-nextcloud-config-file/config.php

The result of the grep is

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

It’s installed throught docker-compose from the nextcloud image. Version 18

On a ubuntu 18.04 box.

Need anything else ?

Hi ramlev,

You mention, that your Nextcloud is installed as Docker container, if I didn’t misunderstand your previous message. Please could you share with us, how you execute the Cron job?

Do you run the cron from the host machine, or within the docker container?

Beside the question of @CFelix can you please provide the output of the following command:

ls -ald /var  /var/www  /var/www/html  /var/www/html/data

That solved my problem, moved to a new server and forgot to start cron.

And i was so focused on file permissions and not the cron part.

Thank you.