How to set Nextcloud user as root, in rootless Docker?

Hi,

The title is a bit weird, but it’s not easy to explain in a short title ^^

I have Rootless Docker installed on Debian Buster.
I have a low permission user (1001:1001) on host to run it.
The goal is to have Nextcloud and another container be able to read+modify each other’s files, and ideally be able to do it myself with the low permission user manually when it’s needed.
If my docker-compose has

  somecontainer:
    image: someimage
    user: 0:0

then on the host, somecontainer's files will be owned by 1001:1001, while in the container they will be owned by 0:0.
Unfortunately, in the Nextcloud container, the files are owned by www-data:root (33:0).

How can I force a root owner inside Nextcloud and solve this ?

I found this shortly but didn’t test it now on my own now. this guide looks good to adopt container to run as specific host user: Running Docker Containers as Current Host User | Juan Treminio - Dallas based senior web developer

That looks great !
However, having to write a custom Dockerfile increases the chance that something will bug later on.
I will think about using it, thanks for the reply :wink: