Docker: permission change on fpm-alpine

Created on 14 Mar 2018  路  3Comments  路  Source: nextcloud/docker

i have switched to fpm-alpine image and permissions are not migrated

app_1    | [13-Mar-2018 23:02:28] WARNING: [pool www] child 17 said into stderr: "NOTICE: PHP message: {"reqId":"xxx","level":3,"time":"2018-03-13T23:02:28+00:00","remoteAddr":"172.18.0.2","user":"--","app":"PHP","method":"GET","url":"\/","message":"touch(): Utime failed: Permission denied at \/var\/www\/html\/lib\/private\/Config.php#240","userAgent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/64.0.3282.186 Safari\/537.36","version":""}"
app_1    | [13-Mar-2018 23:02:28] WARNING: [pool www] child 17 said into stderr: "NOTICE: PHP message: {"reqId":"xxx","level":3,"time":"2018-03-13T23:02:28+00:00","remoteAddr":"172.18.0.2","user":"--","app":"PHP","method":"GET","url":"\/","message":"fopen(\/var\/www\/html\/config\/config.php): failed to open stream: Permission denied at \/var\/www\/html\/lib\/private\/Config.php#241","userAgent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/64.0.3282.186 Safari\/537.36","version":""}"
app_1    | [13-Mar-2018 23:02:28] WARNING: [pool www] child 17 said into stderr: "NOTICE: PHP message: {"reqId":"xxx","level":3,"time":"2018-03-13T23:02:28+00:00","remoteAddr":"172.18.0.2","user":"--","app":"PHP","method":"GET","url":"\/","message":"chmod(): Operation not permitted at \/var\/www\/html\/lib\/private\/Config.php#244","userAgent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/64.0.3282.186 Safari\/537.36","version":""}"
app_1    | [13-Mar-2018 23:02:29] WARNING: [pool www] child 17 said into stderr: "NOTICE: PHP message: {"reqId":"xxx","level":3,"time":"2018-03-13T23:02:29+00:00","remoteAddr":"172.18.0.2","user":"--","app":"index","method":"GET","url":"\/","message":"Exception: {\"Exception\":\"OC\\\\HintException\",\"Message\":\"Can't write into config directory!\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/Config.php(132): OC\\\\Config->writeData()\\n#1 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/SystemConfig.php(100): OC\\\\Config->setValue('instanceid', 'ocpai43x4wxj')\\n#2 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/legacy\\\/util.php(1166): OC\\\\SystemConfig->setValue('instanceid', 'ocpai43x4wxj')\\n#3 \\\/var\\\/www\\\/html\\\/lib\\\/base.php(427): OC_Util::getInstanceId()\\n#4 \\\/var\\\/www\\\/html\\\/lib\\\/base.php(663): OC::initSession()\\n#5 \\\/var\\\/www\\\/html\\\/lib\\\/base.php(1080): OC::init()\\n#6 \\\/var\\\/www\\\/html\\\/index.php(35): require_once('\\\/var\\\/www\...

user and group id have changed in container

uid=82(www-data) gid=82(www-data) groups=82(www-data),82(www-data)

entrypoint have not migrated file perms

wontfix

Most helpful comment

We do not support simple switching between the different variants (apache, fpm, fpm-alpine).
Doing so is like migrating, which means you have to fix the permissions manually.
(docker-compose exec app chown -R www-data:www-data /var/www/html)

I just migrated to fpm-alpine. For those who find this issue and want to achieve the same: The above fix is not correct. You have to do the following to make everything work again:

docker-compose exec app chown -R www-data:root /var/www

This corresponds to https://github.com/nextcloud/docker/blob/783232840a16a3f9100da526edf8ca597800ac2a/Dockerfile-alpine.template#L83 for a fresh install and sets correct gid/uid for both html and data folders.

All 3 comments

We do not support simple switching between the different variants (apache, fpm, fpm-alpine).
Doing so is like migrating, which means you have to fix the permissions manually.
(docker-compose exec app chown -R www-data:www-data /var/www/html)

We do not support simple switching between the different variants (apache, fpm, fpm-alpine).
Doing so is like migrating, which means you have to fix the permissions manually.
(docker-compose exec app chown -R www-data:www-data /var/www/html)

I just migrated to fpm-alpine. For those who find this issue and want to achieve the same: The above fix is not correct. You have to do the following to make everything work again:

docker-compose exec app chown -R www-data:root /var/www

This corresponds to https://github.com/nextcloud/docker/blob/783232840a16a3f9100da526edf8ca597800ac2a/Dockerfile-alpine.template#L83 for a fresh install and sets correct gid/uid for both html and data folders.

for my future self, that it is chown -R 82:0 /var/www if you happen to have this mounted as a nfs share for k8s

Was this page helpful?
0 / 5 - 0 ratings