Configuration was not read or initialized correctly

So i had the same error.

My problem was, i moved the nextcloud instance from one server (raspi 4 ubuntu) to another one( fedora server).
I exported the docker volumes on one server and imported them on the other one.
I also rsynced the local config folder to the new server.

After adding “:Z” to the volumes in the docker-compose it started but threw this
“Configuration was not read or initialized correctly” error.

So basically all the mounted folders had the user with the id 988 as the owner, but the nextcloud docker container needs them to be www-data.
I changed the owner and the group to www-data and now everything works just fine.

How to check if the owner is correct:

  1. Start the docker container (f.e. via docker-compose up -d)
  2. Enter the container by executing ‘docker-compose exec nextcloud /bin/bash’
  3. Check that the folder /var/www/html and all its content has owner www-data by executing ‘ls -la’
  4. If owner or group is different execute 'chown -R www-data:www-data ."
  5. Also execute the chown command for your nextcloud-data folder if its not mounted inside /var/www/html
  6. Optional: While being inside the docker you can also check for general problems. For example create a file inside the config folder or install nano (apt update && apt install) and check if you can change a value in the config.php file.

And now it should work

7 Likes