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
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.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
Docker - phpMyAdmin - A web interface for MySQL and MariaDB
phpMyAdmin - A web interface for MySQL and MariaDB In this tutorial, we are going to use this image: phpmyadmin/phpmyadmin In DSM go to Docker -> Registry and search for phpmyadmin: Download the second result, phpmyadmin/phpmyadmin image...www.synoforum.comDocker - MariaDB - one of the most popular database servers
Mariadb is one of the most popular database servers. Made by the original developers of MySQL. In this tutorial, we are going to use this image: linuxserver/mariadb In DSM go to Docker -> Registry and search for mariadb: Download the second...www.synoforum.comTutorial - How to find UID (userID) and GID (groupID)?
First, you need to SSH into your NAS. When you are in your NAS with the user you want the ID for, just type id and hit Enter. Now you'll get something like this: uid=1031(your_nas_user) gid=100(users) groups=100(users), 101(administrators)...www.synoforum.comDocker - Portainer - Docker container managment made easy
This short article will be about Docker management. I meant to write it up sooner but always pushed it back because everything can be done using the command line. If you are into Docker or just starting, you will know (or soon find out) that it...www.synoforum.comDocker - Portainer - using stacks (docker-compose)
Back in September 2020, I wrote a short article on how to get Portainer up and running as well as connecting it with multiple Docker hosts using the Portainer agent. With that article, you have all you need to get up and running. In this...www.synoforum.com