How to set UID/GID for www-data to local user (1000:1000)?

I was hoping someone could take a look at my Nextcloud docker-compose here and let me know if there is something I can do differently to assign the UID:GID to 1000:1000 within the official Nextcloud container? I saw on one website that I should add in user: "1000:1000" in the compose but the container can’t access the /var/www/html or /var/www/html/data mount points if I do that.

[user@user nextcloud]$ docker exec -it nextcloud /bin/bash
root@<container_id>:/var/www/html# id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)
root@<container_id>:/var/www/html# read escape sequence

[user@user nextcloud]$ pwd
/home/<user>/docker/nextcloud

[user@user nextcloud]$ ls -al
total 16
drwxrwxr-x+  5 user             user       71 May 16 20:51 .
drwxrwxr-x+ 20 user             user     4096 May 16 14:04 ..
drwx------+ 19 systemd-coredump root     4096 May 16 21:08 data
-rw-r--r--+  1 user             user     3045 May 16 20:49 docker-compose.yml
drwxr-xr-x+ 14 33               root     4096 May 16 20:51 ncdata
drwxr-xr-x+  2 root             root        6 May 16 20:51 redis

The container taking onwership of the files with the UID:GID wreaks havoc on my file storage as my Samba shares, MergerFS and SnapRAID are dependent on those permissions being set to my local user and causes all sorts of access problems. I am able to use the linuxserver/netcloud docker image as it has an implicit PUID/PGID environment flag to set but I am unable to get that image, with the nginx backend included, working with Traefik v2. I am sort of stuck between a rock and a hard place with getting Nextcloud and Traefik playing nicely together.

Thanks for any insight on this one.

I am currently having the same problem as you are, did you ever find a solution?

If you’re using the linuxserver.io Docker image, their forums are probably a better place to ask about the specifics of their images.