Nextcloud containerized on Synology with changed uid/gid

Hello together

I try get Nextcloud running on my Synology NAS with changed uid/gid, because I have some folders included where I have no permissions with the default user ā€œ33ā€.

Did anyone manage to get it working?
As soon as I change the user I get multple issues which causes the app to not getting startet:

  1. nextcloud | /entrypoint.sh: 111: cannot create /usr/local/etc/php/conf.d/redis-session.ini: Permission denied
  2. nextcloud | (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
  3. nextcloud | AH00558: apache2: Could not reliably determine the serverā€™s fully qualified domain name, using 192.168.48.4. Set the ā€˜ServerNameā€™ directive globally to suppress this message

1: I managed to get over it when I mount a empty redis-session.ini into the container with the correct permissions.

hi @Mav welcome to the communitiy :handshake:

look at this post

Hi @wwe

Thanks for your replay. Tried you solution still dying with the error:

nextcloud-dev               | Configuring Redis as session handler
nextcloud-dev               | Initializing nextcloud 28.0.2.5 ...
nextcloud-dev               | New nextcloud instance
nextcloud-dev               | Initializing finished
nextcloud-dev               | => Searching for scripts (*.sh) to run, located in the folder: /docker-entrypoint-hooks.d/before-starting
nextcloud-dev               | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.24.0.5. Set the 'ServerName' directive globally to suppress this message
nextcloud-dev               | (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
nextcloud-dev               | no listening sockets available, shutting down
nextcloud-dev               | AH00015: Unable to open logs
nextcloud-dev exited with code 1
docker-compose
services:
  nextcloud:
    image: nextcloud:latest
    container_name: nextcloud-dev
    depends_on:
      - database
      - cache
    links:
      - database
      - cache
    user: "${GLOBAL_VAR_PUID}:${GLOBAL_VAR_PGID}"
    ports:
      - "${NEXTCLOUD_PORT_HTTP}:80"
    networks:
      - traefik_proxy
      - default
    environment:
      MYSQL_HOST: database
      MYSQL_DATABASE: "${NEXTCLOUD_VAR_DB_DATABASE}"
      MYSQL_USER: "${NEXTCLOUD_VAR_DB_USERNAME}"
      MYSQL_PASSWORD: "${NEXTCLOUD_VAR_DB_PASSWORD}"
      REDIS_HOST: redis
      REDIS_HOST_PASSWORD: ${NEXTCLOUD_VAR_REDIS_PASSWORD}
      NEXTCLOUD_TRUSTED_DOMAINS: "${NEXTCLOUD_LABEL_HOSTNAME}.${GLOBAL_LABEL_DOMAIN}"
      TRUSTED_PROXIES: "${NEXTCLOUD_VAR_TRUSTED_PROXIES}"
      OVERWRITEHOST: "${NEXTCLOUD_LABEL_HOSTNAME}.${GLOBAL_LABEL_DOMAIN}"
      OVERWRITEPROTOCOL: "${NEXTCLOUD_VAR_OVERWRITEPROTOCOL}"
    volumes:
      - ./extra/remoteip.conf:/etc/apache2/conf-enabled/remoteip.conf:ro
      - ./extra/redis-session.ini:/usr/local/etc/php/conf.d/redis-session.ini
      - "${NEXTCLOUD_DATA_HOME}/app:/var/www/html:rw"
      - "${NEXTCLOUD_DATA_HOME}/config:/var/www/html/config:rw"
      - "${NEXTCLOUD_DATA_HOME}/custom_apps:/var/www/html/custom_apps:rw"
      - "${NEXTCLOUD_DATA_HOME}/data:/var/www/html/data:rw"
    restart: unless-stopped

I assume you point to this error?

this is a different one. honestly I have no idea why this happens. I tested with version 27 but I think it works with 28 as wellā€¦ my compose doesnā€™t look really different:

  app:
    image: nextcloud:${NEXTCLOUD_VERSION}
    restart: unless-stopped
    user: 1004:1004
    depends_on:
      - db
      - redis
    env_file:
      - ./nextcloud.env
      - ./db.env
      - ./redis.env
    volumes:
      - ./app:/var/www/html
      - ./files:/var/www/html/data
      - ./config:/var/www/html/config
      # https://github.com/nextcloud/docker/issues/182
      - ./php/conf.d/custom.ini:/usr/local/etc/php/conf.d/custom.ini
      - ./redis-session.ini:/usr/local/etc/php/conf.d/redis-session.ini
      - ./remoteip.conf:/etc/apache2/conf-available/remoteip.conf:ro
      - ./apache2.conf:/etc/apache2/apache2.conf:ro
    labels:
      - traefik.enable=true
      - traefik.http.routers.test-nc.entrypoints=web-secure
      - traefik.http.routers.test-nc.priority=1                     # for notify_push
      - traefik.http.routers.test-nc.rule=Host(`${NEXTCLOUD_FQDN}`) #Domain anpassen
      - traefik.http.routers.test-nc.tls=true
      - traefik.http.routers.test-nc.tls.certresolver=letsencryptresolver
      - traefik.http.routers.test-nc.middlewares=secHeaders3@file,nextcloud-redirect@file
      - traefik.http.services.test-nc.loadbalancer.server.port=80
    networks:
      proxy:
      default:
        aliases:
          - nc-app

initially I was thinking port 80 is the problem (as you canā€™t bind this port as non-root) but in my case it seems to work as well! at the moment my test instance is broken after moving to another hardwareā€¦ but I will check later if it works with v28 a well.

@wwe

Seems like you have some more workarounds in place, may I ask you whats the content of these two:

      - ./php/conf.d/custom.ini:/usr/local/etc/php/conf.d/custom.ini
      - ./apache2.conf:/etc/apache2/apache2.conf:ro

both are not related to this issueā€¦

./apache2.conf is just for extending Apache logs as described in the above Wikiā€¦
./php/conf.d/custom.ini is adjusting PHP memory:

#cat ./php/conf.d/custom.ini
max_execution_time=1875
memory_limit=956M
upload_max_filesize = 324M