Need a step-by-step guide for Nextcloud Snap + NFS

etrigan63

New Member
Jun 23, 2025
2
0
1
I am in the process of migrating all of my containers from my TrueNAS server (which will be relegated to storage node duty) to my Proxmox server. I am trying to set up Nextcloud using an Ubuntu 24.04 container in unprivileged mode and running Nextcloud as a snap. I want the data to be stored on the TrueNAS server and accessed via NFS. I have scoured the Internet and have found all sorts of implementations except the one I am doing. Can some one provide clear and concise instructions on how to do this? These instructions will need to cover:
  • File permissions (this is likely the main problem)
  • Proper way to mount the NFS share
  • Getting Nextcloud installed and running with NFS storage
Once this is operational, there are well documented methods for migrating Nextcloud sites.
 
With an priviledged container, you would be able (after enabling the feature in Options -> Features) to configure NFS from the inside of the container, which would be much easier to do than mounting the NFS on the PVE hypervisor and doing the permission dance from there. From a virtualization perspective, doing everything in the guest is much better, because you can in an case of an failure just restore the backup to any PVE without external dependencies.

If you want to do it in an unpriviledged container, you have the following steps:
  • mount the NFS share somewhere on you hypervisor
  • bind-mount the NFS to the container
  • find out which user ids from the NFS needs to be mapped to which user ids in the container (those have a default prefix)
  • try & error until it works
You main entry point would be the documentation, which has all the information you need so you can adapt to what you want:

https://pve.proxmox.com/wiki/Unprivileged_LXC_containers
 
You will be much better off creating a VM using the OS of your choosing (Ubuntu, Debian, whatever) and spinning up Nextcloud in Docker. OR, if you are really dead set on using SNAP to do this, then just spin up an Ubuntu VM. It will be easier than trying to figure out how to mount an NFS share in an unprivileged container. Running Nextcloud in a VM doesn't take hardly any resources.
 
BTW. if you want to give it a go in docker, here is a docker compose file that sets up Nextcloud, MariaDB, Redis, Collabora and Nginx Proxy manager all in one go, with NFS volume mounts. You can set up your shares in TrueNAS, fix the permissions on those shares, change the file path locations in this file to match your layout, change a few passwords and be off to the races. You can even set this up as a stack in portainer if you are not familiar with docker compose.

YAML:
services:
  nextcloud:
    image: nextcloud
    container_name: nextcloud
    restart: unless-stopped
    networks:
      - cloud
      - nginx
    depends_on:
      - nextclouddb
      - redis
    ports:
      - 9090:80 # use whatever port you have free on the left of the colon
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/New_York  # edit to your timezone
      - NEXTCLOUD_DATA_DIR=/mnt/ncdata   # NOTE!! I move the data directory out of /var/www/html so that it can be its own dataset in TrueNAS
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=password1 # change this. Must match password1 below when changed
      - MYSQL_HOST=nextclouddb
      - REDIS_HOST=redis
    volumes:
      - type: volume
        source: html
        target: /var/www/html
        volume:
          nocopy: true
      - type: volume
        source: data
        target: /mnt/ncdata
        volume:
          nocopy: true

  nextclouddb:
    image: mariadb:11.4
    container_name: nextcloud-db
    restart: unless-stopped
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    networks:
      - cloud
    volumes:
      - type: volume
        source: database
        target: /var/lib/mysql
        volume:
          nocopy: true
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/New_York # change to match your timezone
      - MYSQL_ROOT_PASSWORD=password2 # change this, must match password2 below
      - MYSQL_PASSWORD=password1      # change this, must match password1 above
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
 
  collabora:
    image: collabora/code
    container_name: collabora
    restart: unless-stopped
    networks:
      - cloud
      - nginx
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/New_York
      - password=password3          # change this
      - username=nextcloud
      - domain=collabora.yourdomain.com # change to match your domain
      - extra_params=--o:ssl.enable=true
    ports:
      - 9980:9980                  # use whatever ports you have open that don't conflict

  redis:
    image: redis:alpine
    container_name: redis
    restart: unless-stopped
    volumes:
      - type: volume
        source: redis
        target: /data
        volume:
          nocopy: true
    networks:
      - cloud
 
  nginx-proxy:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: nginx-proxy
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/New_York
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    networks:
      - nginx
    volumes:
      - type: volume
        source: nginx
        target: /data
        volume:
          nocopy: true
      - type: volume
        source: letsencrypt
        target: /etc/letsencrypt
        volume:
          nocopy: true

networks:
  cloud:
    name: cloud     # This network should not be reused
    driver: bridge
  nginx:
    name: nginx     # this network can be re-used in future deployments that might use Nginx proxy manager
    driver: bridge

volumes: # change these file paths to match your NFS shares
  html:
    driver_opts:
      type: "nfs"
      o: "vers=4,addr=192.168.50.3,nolock,soft,rw"
      device: ":/mnt/slow_pool/nextcloud/html"
  data:
    driver_opts:
      type: "nfs"
      o: "vers=4,addr=192.168.50.3,nolock,soft,rw"
      device: ":/mnt/slow_pool/nextcloud/data"
  database:
    driver_opts:
      type: "nfs"
      o: "vers=4,addr=192.168.50.3,nolock,soft,rw"
      device: ":/mnt/slow_pool/nextcloud/database"
  redis:
    driver_opts:
      type: "nfs"
      o: "vers=4,addr=192.168.50.3,nolock,soft,rw"
      device: ":/mnt/slow_pool/nextcloud/redis"
  nginx:
    driver_opts:
      type: "nfs"
      o: "vers=4,addr=192.168.50.3,nolock,soft,rw"
      device: ":/mnt/slow_pool/nextcloud/nginx"
  letsencrypt:
    driver_opts:
      type: "nfs"
      o: "vers=4,addr=192.168.50.3,nolock,soft,rw"
      device: ":/mnt/slow_pool/nextcloud/letsencrypt"
 
Last edited: