How to modify the file owner and group of the storage directory in the docker-compose.yml file of owncloud

my owncloud docker-compose.yml file

version: "3"
services:
  owncloud:
    image: owncloud/server
    container_name: owncloud_server
    restart: always
    ports:
      - 8102:8080
    depends_on:
      - mariadb
      - redis
    environment:
      - OWNCLOUD_DOMAIN=192.168.0.205,192.168.1.205
      - OWNCLOUD_TRUSTED_DOMAINS=192.168.0.205,192.168.1.205
      - OWNCLOUD_DB_TYPE=mysql
      - OWNCLOUD_DB_NAME=owncloud
      - OWNCLOUD_DB_USERNAME=owncloud
      - OWNCLOUD_DB_PASSWORD=123
      - OWNCLOUD_DB_HOST=mariadb
      - OWNCLOUD_ADMIN_USERNAME=admin
      - OWNCLOUD_ADMIN_PASSWORD=123
      - OWNCLOUD_MYSQL_UTF8MB4=true
      - OWNCLOUD_REDIS_ENABLED=true
      - OWNCLOUD_REDIS_HOST=redis
    healthcheck:
      test: ["CMD", "/usr/bin/healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - files:/mnt/data

  mariadb:
    image: mysql # minimum required ownCloud version is 10.9
    container_name: owncloud_mariadb
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=123
      - MYSQL_USER=owncloud
      - MYSQL_PASSWORD=123
      - MYSQL_DATABASE=owncloud
      - MARIADB_AUTO_UPGRADE=1
    command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"]
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-u", "root", "--password=owncloud"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - mysql:/var/lib/mysql

  redis:
    image: redis
    container_name: owncloud_redis
    restart: always
    command: ["--databases", "1"]
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - redis:/data

Due to certain reasons, I have discovered that the users storing files are www-data users and www-data groups. I would like to modify the storage user’s ID to complete certain tasks.
thank you !
from sam123

Hey,

i think it could be possible that some knowledge on the permission / owner topic could be gained from the following recent discussion:

I just want the www-data user’s ID in the container to change to another ID number

Hey,

if i’m understanding the postings in the thread linked above correctly it is currently not possible to choose a different ID number “out of the box” in the ownCloud docker containers. If i understand it correctly either www-data is used or no IDs are getting changed.

You can do that with Podman using its usernamespaces feature, but Docker doesn’t seem to implement that feature by default Isolate containers with a user namespace | Docker Docs. It’s one of the many architectural differences behind my reasoning for switching to Podman. I believe that all of these add up to make Podman more a secure platform that works with a typical Linux stack instead of on top of the OS as like a frankensteined piece of software.