Your data directory is not writable Permissions

I’m suddenly experiencing inability to access my self hosted docker containerized NextCloud (NC) server install, and web page shows the following text message

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 

My IT person has left and I’m left trying to deal with this server issues. I did not install NextCloud and I’m unfamiliar with how it’s configured. All was working fine until I tried to access NC this morning. I’m unaware of any disk issues, capacities seem fine.

Here is docker compose file:

root@buildbox:/srv/nextcloud# more docker-compose.yml  
version: '2'

   image: mariadb
   restart: always
   command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
     - /srv/nextcloud/dbcontainer:/var/lib/mysql
     - MYSQL_DATABASE=nextcloud
     - MYSQL_USER=nextcloud

   image: nextcloud:latest
   restart: always
     - 8080:80
     - db
     - /srv/nextcloud/html:/var/www/html
     - MYSQL_DATABASE=nextcloud
     - MYSQL_USER=nextcloud
     - MYSQL_HOST=db

I’ve tried restarting the 4 containers that run NC but nothing changed.

What can I tell you for you to be able to help me?

I don’t know what version we have been running.


I have resolved this issue. I read all posts that had similar if same error messages but in those cases there always seem to be some disk related problem that may have contributed to getting the error.

I saw that in a few cases directory permissions were changed to www-data but I was confused which directory and where I was supposed to add the .ocdata file… just seemed odd and I’m in a state where “do no harm” is paramount.

However, without any real answers I decided to take a chance and found my /srv/nextcloud/html/data (which was empty… also odd since it’s a “data” directory, and did the following:

  • touch .ocdata and changed it’s group and owner to www-data
  • chgrp data directory to www-data
  • chown data directory to www-data
    Then was finally able to login to my nextcloud instance.

I’m puzzled how this happened since it was running fine before???


Hi, I’m facing the same issue and rather an amateur on linux, can you please help and advise exactly the command that you’re using?
I’ve got docker setup for nextcloud and it just suddenly stopped working.