NextCloud

NextCloud
version: "3.2"

services:
  db:
    image: mariadb:10.5.11
    container_name: nextcloud_db
    restart: unless-stopped
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=[root_password]
      - MYSQL_PASSWORD=[db_password]
      - MYSQL_DATABASE=[db_name]
      - MYSQL_USER=[user_name]
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Zurich

  app:
    image: nextcloud
    container_name: nextcloud_app
    restart: unless-stopped
    ports:
      - [port]:80
    links:
      - db
    volumes:
      - app:/var/www/html
      - data:/var/www/html/data
    environment:
      - MYSQL_PASSWORD=[db_password]
      - MYSQL_DATABASE=[db_name]
      - MYSQL_USER=[user_name]
      - MYSQL_HOST=db
      - NEXTCLOUD_DATA_DIR=/var/www/html/data
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Zurich

volumes:
  app:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /home/[user]/docker/nextcloud/app

  data: # If you want it to be a NAS location then it should be a NFS share and mapped to the IP otherwise is just a normal volume as app
    driver: local
    driver_opts:
      type: nfs4
      o: addr=[IP.INTERNAL.NETWORK],rw,nolock,noatime,rsize=262144,wsize=65536
      device: :/mnt/[network_location]/docker/nextcloud

  db:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /home/[network_location]/docker/nextcloud/db

Copy

NOTE:
[user] Corresponds to the folder of you user in your system
[port] The desired port you'd like to map the host
[user_name] -> The desired username for the db
[db_name] -> Database name
[db_password] -> Database password
[root_password] -> Password for the root user
[IP.INTERNAL.NETWORK] -> The location where your NAS NFS share is running ex: 192.168.0.xxx
[network_location] -> Folder structure of your share