Synology: How to Install Nextcloud Using Docker

Synology How to Install Nextcloud Using Docker

Nextcloud is a suite of client-server software for creating and using file hosting services. Nextcloud Hub 3 is free and open-source, which means that anyone is allowed to install and operate it on their own private server devices. In this step by step guide I will show you how to install Nextcloud Hub on your Synology NAS using Docker & Portainer.

Note: This guide works perfectly with the latest Nextcloud Hub 3 25.0.1 release.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.

  • STEP 3

Go to File Station and open the docker folder. Inside the docker folder, create two new folders and name them nextcloud and nextcloudatabase. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Nextcloud Synology NAS Set up 1 new1

  • STEP 4

Inside the nextcloud folder create 5 new folders. Follow the instructions in the image below.

  • config
  • custom_apps
  • data
  • html
  • themes

Note: Be careful to enter only lowercase, not uppercase letters.

Nextcloud Synology NAS Set up 1 new2

  • STEP 5

Log into Portainer using your username and password. On the Portainer left sidebar click on Stacks then + Add stack. Follow the instructions in the image below.

1 Synology Portainer Add Stack

  • STEP 6

In the Name field type in nextcloud. Follow the instructions in the image below.

Note: In the Portainer Stacks Web editor Copy Paste the code below.

version: '3'

services:
  
  mariadb:
    container_name: mariadbnextcloud
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-read-only-compressed=OFF
    restart: always
    volumes:
      - /volume1/docker/nextcloudatabase:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=rootpassword
      - MYSQL_PASSWORD=mysqlpassword
      - MYSQL_DATABASE=nextcloudatabasename
      - MYSQL_USER=nextclouduser

  nextcloud:
    container_name: nextcloud
    ports:
      - 8082:80
    depends_on:
      - mariadb
    environment:
      - PUID=1026
      - PGID=100
      - TZ=Romania/Bucharest
    volumes:
      - /volume1/docker/nextcloud/html:/var/www/html
      - /volume1/docker/nextcloud/custom_apps:/var/www/html/custom_apps
      - /volume1/docker/nextcloud/config:/var/www/html/config
      - /volume1/docker/nextcloud/data:/var/www/html/data
      - /volume1/docker/nextcloud/themes:/var/www/html/themes/
    image: nextcloud
    restart: always

volumes:
  mariadb: # nextcloud

Note: After you paste the code in the Web editor, change the value numbers for PUID and PGID with your own values. (Follow my step by step guide on how to do this.)
Note: After you paste the code in the Web editor, change the value for TZ (Select your current Time Zone from this list).

1 Nextcloud Synology NAS Set up

  • STEP 7

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

1 Nextcloud Synology NAS Set up

  • STEP 8

If everything goes right, you will see this message at the top right of your screen: “Success Stack successfully deployed“.

3 Nextcloud Synology NAS Set up

  • STEP 9

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 10

The installation process can take up to a few seconds/minutes. It will depend on your Internet speed connection. You should wait 2-3 minutes because the installation process will take some time. If you try to access http://Synology-ip-address:8082 too soon, you will get a blank “unable to connect” page. Refresh the page after 2-3 minutes. Now open your browser and type in http://Synology-ip-address:8082/ Follow the instructions in the image below.

Add the following data:

  1. Create an admin account: type in your own Username and Password.
  2. Storage & database: choose MySQL/MariaDB
  3. On the Database user field type in: nextclouduser
  4. On the Database password field type in: mysqlpassword
  5. On the Database name field type in: nextcloudatabasename
  6. On the Database host field type in: mariadb
  7. Click Install.

Nextcloud Hub 3 Synology NAS Docker Set up 7 new

  • STEP 11

Install the recommended apps. Click Install recommended apps. Follow the instructions in the image below.

Nextcloud Hub 3 Synology NAS Docker Set up 8 new

Enjoy your Nextcloud via Docker!

Nextcloud Hub 3 Synology NAS Docker Set up 9 new

Troubleshooting

Note: What if I get error 0770? Your data directory is readable by other users.
Please change the permissions to 0770 so that the directory cannot be listed by other users.

0770 nextcloud

If you get this error Right click on the nextcloud folder in File Station then click Properties. Click on the Permission tab then go to the Advanced options. Select Make inherited permissions explicit. Now Select User “Everyone” then Delete it using Delete tab. Check “Apply to this folder, sub-folders and files”. Click Save.

Note: If you want to run Nextcloud container over HTTPS check How to Run Docker Containers Over HTTPS.

Note: Find out how to update Nextcloud container with the latest image.
Note: Can I run Docker on my Synology NAS? See the supported models.
Note: I don’t use nextcloud via Docker I use the standard installation method for nextcloud. This helps me to do serious backups.
Note: If you encounter mem_swappiness issue contact me for instructions on how to solve it.
Note: Nextcloud together with the OnlyOffice document server.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.

This post was updated on Friday / November 4th, 2022 at 12:49 AM