Having just migrated from nextcloud bare-metal to nextcloud docker-compose, I have now just run into my first upgrade, which fails due to Operation not permitted and permission denied errors.
In my setup, I have /var/www/html
as a docker volume. The docker volume internally has the permissions ‘www-data:www-data’ for all nextcloud/php files. My data volume is /var/www/data
thus isolated from the html bits.
During start of nextcloud, it wants to upgrade from to which internally uses ‘rsync’ from the entrypoint to copy the installation files to my volume. But this is where the problems start, because the container is doing this step as root, instead of www-data, it now cannot copy/create files anymore. Changing the volume (from the /var/lib/docker/volumes/…/_data) to root:root (but keeping www-data on config.php), adding o+w and running the container with 'cap-add fowner,chown.
This gets me through the upgrade, but have to then ‘undo’ my chown/o+w-ing, and start NC again.
However, I then am greeted with nextcloud-init-sync.lock
; but I may have had this issue before as well as I found o+w bit to have been set on the root of my volume … though I have safely removed that again as it’s enough to just have the file with root:root permissions. This does indicate that the volume needs access for two users, www-data for the php files during ‘runtime’ and root for nextcloud-init-sync.lock for startup.
I’m sure this isn’t the way/intended behavior is it? What am I doing wrong?
P.S. No idea why or how or even if important, but I’m also getting
Warning: /var/www/html/config/autoconfig.php differs from the latest version of this image at /usr/src/nextcloud/config/autoconfig.php
Warning: /var/www/html/config/redis.config.php differs from the latest version of this image at /usr/src/nextcloud/config/redis.config.php
Warning: /var/www/html/config/s3.config.php differs from the latest version of this image at /usr/src/nextcloud/config/s3.config.php
Warning: /var/www/html/config/smtp.config.php differs from the latest version of this image at /usr/src/nextcloud/config/smtp.config.php
Warning: /var/www/html/config/upgrade-disable-web.config.php differs from the latest version of this image at /usr/src/nextcloud/config/upgrade-disable-web.config.php
as part of my upgrade. I can just copy these files no problem, but wondered why the upgrade didn’t do this itself. Those files are mostly not existing …