NextCloud on Synology NAS using Docker compose (with Portainer)

Docker NextCloud on Synology NAS using Docker compose (with Portainer)

nextcloud-square-logo.png



In this tutorial, we are going to use Docker compose to install the NextCloud official Docker image with Portainer.



To start​


This is going to be just one of many ways to install NextCloud. I am going to show you my way.

First, you need to have Docker installed on your NAS (if it's supported).

Now install Portainer. You can use @Rusty's tutorial: Docker - Portainer - Docker container managment made easy




Database​


Now that we have all the required tools, first, install the MariaDB using this tutorial: Docker - MariaDB - one of the most popular database servers

You can also use MySQL or PostgreSQL, but in this tutorial, we are using MariaDB.

For accessing the database I use phpMyAdmin: Docker - phpMyAdmin - A web interface for MySQL and MariaDB

Login to phpMyAdmin and create a database for Nextcloud. Write down your database name, database user, and password. You are going to need this later.




NextCloud​


First, make sure to create folders for Nextcloud in your FileStation before you enter the docker-compose code.

I am using this location: docker/nextcloud. and this is on Volume 1:
  • /volume1/docker/nextcloud/html
  • /volume1/docker/nextcloud/custom_apps
  • /volume1/docker/nextcloud/config
  • /volume1/docker/nextcloud/data
  • /volume1/docker/nextcloud/themes

Screenshot 2021-09-16 at 12.11.24.png



Now we are going to use the official image: https://hub.docker.com/_/nextcloud.

Login to your Portainer and create a Stack (read more about how to use stacks here: Docker - Portainer - using stacks (docker-compose)).

Now use this docker-compose:
YAML:
version: "3.5"
services:
  app:
    image: nextcloud:latest
    restart: always
    network_mode: bridge
    container_name: nextcloud
    ports:
      - 8787:80
    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/
    environment:
      - PUID=1031
      - PGID=1023
      - TZ=London/Europe
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=user_nextcloud
      - MYSQL_PASSWORD=********
      - MYSQL_HOST=192.168.0.8:3338
      - NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.example.com
      - OVERWRITEPROTOCOL=https

We are using the latest image.

Use NEXTCLOUD_TRUSTED_DOMAINS variable if you are using a custom domain, otherwise, you can remove it.

Use OVERWRITEPROTOCOL=https variable to redirect your domain to HTTPS protocol. If you won't use your custom domain for NextCloud and use it only locally, then you can remove this variable too.

You can change the port if you wish (the left number only).

Make sure to change the PUID and PGID to your http user ID and group (Tutorial - How to find UID (userID) and GID (groupID)?).

Change TZ to your timezone.

The next three variables are for the database. Make sure to use the right credentials.
*Note that I like to have the database separated and not in the same stack, but you can combine it together in one stack.

For host use yourNASip:databaseLocalPort.



Deploy the stack and that should be enough. Open NextCloud on yourNASip:nextcloudPort. Continue with the guided NextCloud installation.

As already said, this can be done in many ways. I hope this way will help someone to install NextCloud.
Related resources



Similar resources
Resource starter Title Category
wwwampy Docker Nextcloud - the self-hosted productivity platform that keeps you in control Tutorials
fredbert Tutorial Adding a User to the Administrators Group on a Synology Router Tutorials
wwwampy Tutorial Back up your Mac with Time Machine to Synology NAS Tutorials
jeyare App How to monitor, control, damage check of disks in your Synology NAS Apps and Packages
Geeked Tutorial How to setup and run Reactive Resume in Docker on Synology Tutorials
jeyare Ubiquiti Migrating existing Ubiquiti UniFi Controller to Docker in Synology NAS Tutorials
Robbie Tutorial Native macOS Finder integration with Synology Universal Search Tutorials
WST16 Network ports used by Synology services Tutorials
wizard99 Tutorial Performing the Synology Memory Test and Extracting the "HIDDEN" Memtest Results via a New Method Tutorials
Rusty Tutorial PXE boot via Synology NAS Tutorials
Rusty Tutorial Synology - Pushover notification integration Tutorials
skavans App Synology DS Manager – Download Station macOS app and Safari Extension [2020 NEW] Apps and Packages
fredbert Security Synology Product Security Advisory Tutorials
Rusty Tutorial Synology Reverse Proxy Tutorials
one-eyed-king Tutorial Synology Reverse Proxy under the hood Tutorials
Rusty TeamViewer for Synology NAS Other
marco App Weemple Video Station Validator - App to validate the metadata of Synology Video Station Apps and Packages
SynoMan Tutorial How to SSH into a NAS? Tutorials
NAS Newbie Tutorial NAS Remote Access for Newbies: Part 1 - LAN Overview & Port Forwarding Tutorials
NAS Newbie Tutorial NAS Remote Access for Newbies: Part 2 - Port 443 & Reverse Proxy Tutorials
NAS Newbie Tutorial NAS Remote Access for Newbies: Part 3 - Accessing Mobile Apps via Reverse Proxy Tutorials
NAS Newbie Tutorial NAS Remote Access for Newbies: Part 4 - Reverse Proxy for Multiple NAS on a Single LAN Tutorials
jeyare Tutorial Newbies - Your first NAS, part 1 Tutorials
jeyare Tutorial Newbies - Your first NAS, part 2 ... Network preparation Tutorials
jeyare Tutorial Setup consideration: NAS Disks vs LAN Environment Tutorials
Similar resources
Docker Nextcloud - the self-hosted productivity platform that keeps you in control
Tutorial Adding a User to the Administrators Group on a Synology Router
Tutorial Back up your Mac with Time Machine to Synology NAS
App How to monitor, control, damage check of disks in your Synology NAS
Tutorial How to setup and run Reactive Resume in Docker on Synology
Ubiquiti Migrating existing Ubiquiti UniFi Controller to Docker in Synology NAS
Tutorial Native macOS Finder integration with Synology Universal Search
Network ports used by Synology services
Tutorial Performing the Synology Memory Test and Extracting the "HIDDEN" Memtest Results via a New Method
Tutorial PXE boot via Synology NAS
Tutorial Synology - Pushover notification integration
App Synology DS Manager – Download Station macOS app and Safari Extension [2020 NEW]
Security Synology Product Security Advisory
Tutorial Synology Reverse Proxy
Tutorial Synology Reverse Proxy under the hood
TeamViewer for Synology NAS
App Weemple Video Station Validator - App to validate the metadata of Synology Video Station
Tutorial How to SSH into a NAS?
Tutorial NAS Remote Access for Newbies: Part 1 - LAN Overview & Port Forwarding
Tutorial NAS Remote Access for Newbies: Part 2 - Port 443 & Reverse Proxy
Tutorial NAS Remote Access for Newbies: Part 3 - Accessing Mobile Apps via Reverse Proxy
Tutorial NAS Remote Access for Newbies: Part 4 - Reverse Proxy for Multiple NAS on a Single LAN
Tutorial Newbies - Your first NAS, part 1
Tutorial Newbies - Your first NAS, part 2 ... Network preparation
Tutorial Setup consideration: NAS Disks vs LAN Environment
Top