# Nextcloud on Synology NAS, with Docker Compose ## Install Docker You can install Docker through the Synology DiskStation Manager (DSM) **Package Center**. Just search for "docker" and follow the wizard to install docker. ![](https://i.imgur.com/7crWrFO.jpg =600x) ## Enable SSH You will need to have SSH enabled from the Synology DSM control panel. Please feel free to skip this step if you've already done that. ![](https://i.imgur.com/EQj4uLU.png =600x) ## Create folder Use the File Station from Synology DSM to create a new folder in one of your volumes. I created the folder in my `docker` folder. ![](https://i.imgur.com/jyEIk3f.png =600x) You need to ensure the user you will SSH with has permissions to create files and folders inside the `docker` folder. ## Create docker-compose manifest Create a new file (which I called nextcloud.yaml) in the folder you just created. As per the official docs, you have to set the values for `MYSQL_ROOT_PASSWORD` and `MYSQL_PASSWORD` in the following yaml. ```yaml= version: '2' volumes: nextcloud: db: services: db: image: mariadb restart: always command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed volumes: - db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD= - MYSQL_PASSWORD= - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud app: image: nextcloud restart: always ports: - 8080:80 links: - db volumes: - nextcloud:/var/www/html environment: - MYSQL_PASSWORD= - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - MYSQL_HOST=db ``` IMPORTANT: I also had to change the `command` attribute of the mariadb service, to address the following error: ` Error while trying to initialise the database: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.` ## Run **NOTE:** By default, my admin user didn't have permissions to run `docker` commands, so I had to use `sudo`. It was somewhat confusing that the password requested by `sudo` was the password of the same user I was logged in as (the user was an administrator). ```bash= $ sudo docker-compose --file nextcloud.yml up --detach ``` ## Setup nextcloud You can access the nextcloud web UI at: http://your.nas.ip.address:8080. You will then see the following screen: ![](https://i.imgur.com/0OckcQp.png =600x) Go ahead and add a username/password for your administrator. I also enabled the installation of the recommended apps, so I can explore what nextcloud has to offer (I am currently a first-time nextcloud user). This took a bit of time. If everything goes well, you'll see the following screen. ![](https://i.imgur.com/pBexcY0.png =600x) Once the installation is completed, you will see this screen: ![](https://i.imgur.com/azCK5Sr.jpg =600x) ## Congrats! Nextcloud is up and running on your Synology NAS! Next step: use nextcloud as the replacement for iCloud photos!