Can't write to directory?

so I’m trying to deploy a docker nextcloud on my NUC, and I’ve tried both linuxserver/nextcloud and nextcloud under docker hub, same problem.

I want to point nextcloud storage to a unionfs plexdrive, so I mounted /var/www/html in container to /mnt/unionfs/files on my host machine. the /mnt/unionfs/ are accessible by all my other docker containers such as radarr, sonarr, Plex, etc, they have no problem whatsoever. however as long as I point nextcloud to that directory, I’m either getting a ‘general error 10, disk I/O error’, or getting a ‘cant read or write to /var/www/html’ error.
I tried to point nextcloud to other directory and it works fine.

I tried to set nextcloud docker container to run as root, to run in privileged mode, to have PUID/PGID set to 0 (root) or 1000 (my user). none of them solve the problem.

it’s driving me crazy… can anyone help me with it?

much appreciated.

Seem to me rights acces are badly set: usually nextcloud directorie and data directories need to be set for user www-data

apache2 conf

<VirtualHost *:80>
               ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        Protocols h2 http/1.1
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =redacted
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>


<IfModule mod_ssl.c>

<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        Protocols h2 http/1.1
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLCertificateFile /etc/letsencrypt/live/redacted/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/redacted/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
        ServerName redacted
        # Guarantee HTTPS for 6 Month including Sub Domains
    Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains"


</VirtualHost>

SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite       EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH


SSLHonorCipherOrder     on
SSLSessionTickets       off
SSLOptions +StrictRequire


# OCSP Stapling, only in httpd 2.3.3 and later
SSLUseStapling          on
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache        shmcb:/var/run/ocsp(128000)



# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</IfModule>



drwxr-xr-x 33 www-data www-data  4096 juil. 25 01:39 3rdparty
-rw-r--r--  1 root     root       758 juil. 25 01:53 abuseip.html
drwxr-xr-x 69 www-data www-data  4096 août  13 21:35 apps
-rw-r--r--  1 www-data www-data 12063 juil. 25 01:39 AUTHORS
drwxr-xr-x  2 www-data www-data  4096 août  17 04:40 config
-rw-r--r--  1 www-data www-data  3593 juil. 25 01:39 console.php
drwxr-xr-x 17 www-data www-data  4096 juil. 25 01:39 core
-rw-r--r--  1 www-data www-data  4944 juil. 25 01:39 cron.php
drwxr-xr-x  2 www-data www-data  4096 juin  14 21:26 data
-rw-r--r--  1 www-data www-data  2806 juil. 25 01:39 .htaccess
-rw-r--r--  1 www-data www-data   179 juil. 25 01:39 index.html
-rw-r--r--  1 www-data www-data  3664 juil. 25 01:39 index.php
drwxr-xr-x  6 www-data www-data  4096 juil. 25 01:39 lib
-rw-r--r--  1 www-data www-data   283 juil. 25 01:39 occ
drwxr-xr-x  2 www-data www-data  4096 juil. 25 01:39 ocs
drwxr-xr-x  2 www-data www-data  4096 juil. 25 01:39 ocs-provider
-rw-r--r--  1 www-data www-data  3214 juil. 25 01:39 public.php
-rw-r--r--  1 www-data www-data  5370 juil. 25 01:39 remote.php
drwxr-xr-x  4 www-data www-data  4096 juil. 25 01:39 resources
-rw-r--r--  1 www-data www-data    26 juil. 25 01:39 robots.txt
drwxr-xr-x 14 www-data www-data  4096 juil. 25 01:39 settings
-rw-r--r--  1 www-data www-data  2274 juil. 25 01:39 status.php
-rw-r--r--  1 root     root        21 juil. 25 01:53 test.php
drwxr-xr-x  3 www-data www-data  4096 juil. 25 01:39 themes
drwxr-xr-x  2 www-data www-data  4096 juin  14 21:23 updater
-rw-r--r--  1 www-data www-data   163 juil. 25 01:39 .user.ini
-rw-r--r--  1 www-data www-data   362 juil. 25 01:39 version.php

and data directorie:

drwxr-xr-x 11 www-data www-data    4096 juin  14 21:35 appdata_oc
drwxr-xr-x  4 www-data www-data    4096 août  18 13:25 asdf123
drwxr-xr-x  2 www-data www-data    4096 juil. 25 01:39 files_external
drwxr-xr-x  8 www-data www-data    4096 juil. 11 12:34 google-10
drwxr-xr-x  7 www-data www-data    4096 juin  21 09:13 google-10
drwxr-xr-x  6 www-data www-data    4096 juil. 26 15:33 google-10
drwxr-xr-x  5 www-data www-data    4096 août   3 06:28 google-10
drwxr-xr-x  8 www-data www-data    4096 août   3 13:54 google-10
drwxr-xr-x  4 www-data www-data    4096 juin  14 22:08 __groupfolders
-rw-r--r--  1 www-data www-data     324 juil. 25 01:39 .htaccess
-rw-r--r--  1 www-data www-data       0 juil. 25 01:39 index.html
drwx------  2 www-data www-data   16384 juin  14 21:06 lost+found
drwxr-xr-x  4 www-data www-data    4096 juin  14 21:57 news
drwxr-xr-x  5 www-data www-data    4096 juil. 25 01:48 nextadmin
-rw-r-----  1 www-data www-data 2177528 août  22 19:23 nextcloud.log
-rw-r--r--  1 www-data www-data       0 juil. 25 01:39 .ocdata
drwxr-xr-x  2 www-data www-data    4096 juil.  5 12:24 snpass
drwxr-xr-x  6 www-data www-data    4096 juin  20 17:54 strat1401
-rw-r--r--  1 www-data www-data   13222 juil. 25 01:39 updater.log
drwxr-xr-x  4 www-data www-data    4096 juil. 25 01:39 updater-oc

so how should I fix this?
I’m sorry I have very limited linux skills, all I could do is execute some simple automated scripts…

log via ssh,

cd to your diretory

use command chown as root user

chown -R www-data:www-data

so do I run it on host or in docker container?

I pass … Not using docker because of those behaviors …

Maybee someone else can help you, or directly on docker community support …

Sorry