Running ASP.NET Core Apps on a Synology NAS with Docker

Now I’ve got the Synology NAS up and running, I thought it would be interesting to see what the Docker support is like. You can essentially run Docker container instances on the NAS box which also means you can deploy your own custom .NET Core apps to the Synology box.

This post is organized into 3 parts:

  1. Creating and testing a Docker-enabled ASP.NET Core app locally
  2. Deploying the app to the Synology NAS via Docker Hub
  3. Deploying the app locally to the NAS

Part 1: Creating and Testing a Docker ASP.NET Core App Locally

There’s a few things to setup to allow you to deploy and Test  Docker containers locally.

The first is to enable Hyper-V in Windows, this is a prerequisite of Docker Desktop for Windows:

Installing Windows Hyper-V Feature

Once you’ve enabled Hyper-V (a restart will probably be required) you can go and download and install Docker Desktop for Windows – this will allow you to enable Docker support when you create the project in Visual Studio.

Once Docker Desktop is installed and running you can check it’s running with PowerShell:

PS C:\Users\Admin> docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:23:10 2020
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:29:16 2020
  OS/Arch:          linux/amd64
  Experimental:     false
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
  Version:          0.18.0
  GitCommit:        fec3683
PS C:\Users\Admin>

Now you can fire up Visual Studio and create a new ASP.NET Core web application and tick the Enable Docker Support checkbox:

Creating an ASP.NET Core Web App with Docker Support

Once the project is created, you can click the Run button in Visual Studio (it should say “Docker” next to it).

Checking  the Output window for Container Tools you should can see something like:

========== Checking for Container Prerequisites ==========
Verifying that Docker Desktop is installed...
Docker Desktop is installed.
========== Verifying that Docker Desktop is running... ==========
Verifying that Docker Desktop is running...
Docker Desktop is running.
========== Verifying Docker OS ==========
Verifying that Docker Desktop's operating system mode matches the project's target operating system...
Docker Desktop's operating system mode matches the project's target operating system.
========== Pulling Required Images ==========
Checking for missing Docker images...
Pulling Docker images. To cancel this download, close the command prompt window.
docker pull

After a while the build might fail with the following error: Error    CTC1001    Volume sharing is not enabled. On the Settings screen in Docker Desktop, click Shared Drives, and select the drive(s) containing your project files.  

To fix this, open up the Docker Desktop UI, and find the File Sharing section and enable C: drive if you want to make it available to Docker – this should fix the error:

Enabling File Sharing in Docker Desktop


Once this this change is applied and Docker Desktop restarted, click the Start button again in Visual Studio and after accepting dialog boxes to do with firewall and local certificate the web app should start up and run successfully and Docker Desktop should show the web app container running:

ASP.NET Core app running in Docker Desktop for Windows

So now you have a Docker-enabled .NET Core web app and have tested it locally you can deploy it to the Synology NAS.

Part 2: Deploying an ASP.NET Core Docker App To a Synology NAS Via Docker Hub (AKA There And Back Again – a Docker Hub Tale)

Docker Hub is place (“registry”) where you can store and manage Docker images. These images can then be pulled (downloaded) by  a Docker host and then a container started from this image.

Visual Studio has built-in support for pushing an image to Docker Hub and the Synology Docker app has the ability to pull images from Docker Hub. Images on Docker Hub can be public or private (depending on what plan you are using).

Once you’ve created a Docker Hub account, in Visual Studio go to the Build menu and choose Publish WebApplication1 (or whatever the name of your project is) and click Start. You will need to choose a publish target of Container Registry and choose Docker Hub:

Choosing Docker Hub as a publish target in Visual Studio

Click Create Profile - you’ll need to supply your Docker Hub user name and password and click save.

You can now click the Publish button and wait for a little while:

Publishing a ASP.NET Core web app to Docker Hub

You should see the app being pushed to Docker Hub:

Pushing to Docker Hub

Once the publish is complete you can head over to Docker Hub and you should see your image:

Docker Hub image

Now the image is in Docker Hub, you can enable Docker support on the Synology NAS, pull the image from Docker Hub, and start a container on the NAS.

First log into the Synology as an admin account and open the Package Center. Here you can search for “Docker” and install the Docker app:

Installing Docker support on a Synology NAS

Once you’ve installed the Docker app, open it and head to the Image section, click the Add button and choose Add From Url. Now you can head over to Docker Hub and copy the URL for your image, for example it will look something like this:

Pulling an image from Docker Hub to a Synology NAS

Click Add and the image will be downloaded from Docker Hub to the NAS.

Once the image has downloaded, click on it and click the Launch button. This will enable you to start a container instance from the image.

You’ll need to click on Advanced Settings and go to the Port Settings tab. In the Dockerfile in Visual Studio, the image is set to use port 80. We need to map a port on the NAS to this port 80 in the container. For example you could set up port 7500 on the NAS itself to map traffic to port 80 in the container:

Mapping Synology port to docker container port

Click Apply and then Next. You will be given a summary of the settings (the “Run this container after the wizard is finished” box is ticked) and click Apply to finish the wizard and start the container.

You should now be able to see the container running in the Container section:

Docker container running on a Synology NAS

You can now point your browser to your NAS IP and the port your chose when staring the container, for example:

You should now see your ASP.NET Core web app being served from the Docker container on the Synology NAS:

ASP.NET Core Web App running in a Docker container on a Synology NAS

Part 3: Directly Deploying Docker Container to a Synology NAS

The first step is to publish the web app and copy the published files to the Synology. You could also publish directly to a folder on the NAS such as: \\SYN001\Test1\DockerPublish

In Visual Studio from the Build menu choose Publish WebApplication1. Create a new Publish Profile this time using a Folder Target and as the folder choose a folder on the Synology:

Publish to Synoloy NAS folder from Visual Studio

Click Create Profile and then click Publish. Once this is finished you should see the web app files published to the Synology folder.

In the DockerPublish folder (this is an arbitrary name) on the NAS create a new Dockerfile with the following contents:

COPY . /app
ENTRYPOINT ["dotnet", "WebApplication1.dll"]

Your folder on the Synology should now look like something like this:


The next step is to build the Docker image on the Synology NAS. To do this you can SSH into the NAS and use Docker build.

The first step is to enable SSH access on the Synology, you can do this from the Synology Control Panel in the Terminal & SNMP section – tick the Enable SSH Service box and click Apply:

Enabling SSH on a Synology NAS

Next in Windows, open a new PowerShell window and enter:

ssh Jason@

Replace “Jason” with the name of one of your admin users and the IP address with the address of your Synology NAS – you will then need to enter the user’s password.

We need to SSH in as root (or set up a new user on the NAS). Be careful working in root or you could seriously mess your NAS up or introduce security problems. To get root access enter:

sudo -i

And once again enter the password.

You can now change to the folder that contains the published web app and Dockerfile:

cd /volume1/Test1/DockerPublish

And now build the image:

docker build -t manualwebapp .

This will produce the following output:

Sending build context to Docker daemon  4.706MB
Step 1/5 : FROM
3.1-buster-slim: Pulling from dotnet/core/aspnet
c499e6d256d6: Pull complete
251bcd0af921: Pull complete
852994ba072a: Pull complete
f64c6405f94b: Pull complete
9347e53e1c3a: Pull complete
Digest: sha256:a9e160dbf5ed62c358f18af8c4daf0d7c0c30f203c0dd8dff94a86598c80003b
Status: Downloaded newer image for
 ---> c819eb4381e7
Step 2/5 : COPY . /app
 ---> 0beff55307c9
Step 3/5 : WORKDIR /app
 ---> Running in e731c0fa1d6e
Removing intermediate container e731c0fa1d6e
 ---> b64c09a9d51e
Step 4/5 : EXPOSE 80
 ---> Running in 6fddd1f77f4e
Removing intermediate container 6fddd1f77f4e
 ---> 9aa4035379dc
Step 5/5 : ENTRYPOINT ["dotnet", "WebApplication1.dll"]
 ---> Running in 4f0b086e44d3
Removing intermediate container 4f0b086e44d3
 ---> ead6395bf486
Successfully built ead6395bf486
Successfully tagged manualwebapp:latest

If you now head to the Docker app on the Synology you will see the manualwebapp image:

Docker build image on Synology NAS

You can start a container from this image as we did before using the Synology GUI or from the PowerShell prompt - we can start it with the following command (notice we’re mapping port 7501 on the NAS to port 80 in the container):

docker run --name manualtestcontainer -p 7501:80 -d manualwebapp

Now heading back the the Synology GUI you should see a container called manualtestcontainer running:

Docker container running on Synology NAS



Now you can head to the URL in a browser (e.g. and see the ASP.NET Core web app running in the Docker container:

ASP.NET Core running in Docker app running on Synology NAS


The ability to run Docker containers on a NAS is really nice, not only can you develop your own apps and deploy them as containers, you can also use images from a registry such as Docker Hub, for example MySQL, ghost blogging engine, etc. You should of course only use images you trust.

If you have any cool containers running on your Synology let me know in the comments!


Synology DiskStation DS1618 Plus Setup And Initial Review

Early this year I tweeted this:

After seeing this, Synology reached out to me and asked if they could give me a unit to review. The contents of this post are my opinions based purely on my experience and this article was not pre-approved or edited by Synology.

What is a NAS?

A NAS device or Network Attached Storage device allows you to serve files over a network. A NAS can be a purpose built piece of hardware (like the Synology unit being discussed in this article) or a server set up with specific software to make it act like a NAS.

A NAS is like a hard disk that you can access over the network (potentially by multiple users) but depending on the hardware/software it can do a lot more. For example a NAS can enable you to fit multiple individual hard disks in a RAID configuration. RAID (Redundant Array of Inexpensive Disks or Redundant Array of Independent Disks) allows you to combine multiple disks/SSDs in a number of different ways.

RAID comes in a number of flavours (“levels”) with  names such as RAID 0 or RAID 10. Each RAID level has its own benefit/trade-offs in terms of number of redundant disks, read/write speeds, and storage efficiency. For example, given 4 hard disks you could set up RAID to allow 2 disks to fail without loosing data, but you will not be able to use all the disk space on all the drives for your own storage.

In summary, a NAS is a network device that exposes file storage from one or more drives and may also use RAID for some redundancy.

One thing to bear in mind is RAID is not the same as backup. RAID gives you redundancy for hardware (drive) failure. If a drive fails in a RAID array you can usually keep working and just replace the damaged drive with a new one. You should still have a good backup strategy in place that backups data on the NAS, for example making sure you have off-site backups in case the building where the NAS is burns down, gets flooded, etc.. There are a number of ways you could do this on the Synology such as setting up Cloud Sync to Dropbox/Onedrive/etc or using an actual backup service that integrates with the Synology such as Synology C2, Backblaze, etc.

Setting Up a Synology DS1618+

Synology DS1618+ Box

The first think is to decide what redundancy characteristics  you want for your data that you’ll be storing on the Synology. Synology have a handy RAID calculator to help you work out how many drives will give you what amount of storage for different RAID levels.

For this device I decided I wanted 2 disk redundancy. This mean that even if 2 disks fails no data will be lost (using SHR-2). SHR (Synology Hybrid Raid) and SHR-2 are RAID-like configurations but allow mixing disks of different sizes.

I decided I wanted to start with 6 TB of accessible storage to start with to keep initial costs low. This means with 2 redundant disks (using SHR-2) I need a total of 4 drives each one being 3 TB in size.

There are hard drives that are designed for NAS applications and offer features such as rotational vibrational sensors and other features that make them more suitable than normal desktop hard drives. I decided for this Synology NAS I would go with 2 Western Digital Red NAS drives and 2 Seagate IronWolf NAS drives. The reason I went with 2 different brands is to minimize the chance of a manufacturing error in a single batch failing all the drives at once. This might however be overkill.

For maximum compatibility you should choose drives that have been verified as compatible, there is a handy compatibility list you can use though I found it almost impossible to find drives here in Australia that exactly matched the drive model numbers/firmware/etc. On the compatibility list you can also see drives that are explicitly incompatible. Before ordering the drives I checked that they were not explicitly marked as incompatible even though they also did not match exactly the drives on the compatible list.

Out of the box, the DS1618+ comes with a couple of network cables, a power cord, some mounting screws if you are using 2.5” drives.

DS1618+ unboxing

Installing Drives

Installing the drives is pretty easy, each bay pops open and the tray slides out into which the hard drive is inserted. For 3.5” drives no screws are required, instead the drives are help in place by a plastic strip on each side. These plastic were a bit fiddly however and felt a bit fragile and I was worried that I was going to snap them when trying to remove them from the tray. When the drive is inserted and the plastic strips clipped back in they feel like they hold the drive solidly in place however. Once the drive is held in place it can be slotted back into the NAS.

Adding a drive to the DS1618+

The drives can be secured in place using the supplied “key” to prevent the drives from accidentally being removed.

DS1618+ Setup

Once all 4 disks were installed, I connected the power cord and the network cable to the modem/router.

Back on my PC in a browser I navigated to – this then forwarded the browser to the NAS.

A wizard like setup process leads you through the required steps to install the NAS OS, create an admin user account, and optionally enable QuickConnect that allows you to access the management interface on your NAS over the Internet without needing to setup complex port forwarding rules which is a nice feature.

Once the setup is complete the web interface opens.

Synology DiskStation interface

From here you can manage the NAS and install additional packages such as Dropbox/Onedrive/etc cloud sync. This ability to install “apps” onto the NAS is a powerful feature that helps to add extra value to the NAS proposition.

Synology Package Center

At this point I had not actually setup or chosen a RAID level so I wasn’t sure what to do next.

Eventually I found the Main Menu button at the top left that allowed be to open the Storage Manager app that allows the setup of disks – it would have been nice if this was part of the initial setup wizard/guided workflow – at least for beginner users like myself.

There are 2 key concepts: Storage Pools and Volumes.This is where things started to get a little confusing for as a first-time NAS user, I knew that I wanted a single volume using SHR-2 but was not sure how to get there.

After a few minutes looking at the documentation I understood that a storage pool is a collection of drives. There are 2 types of storage pools: “Storage pool for better performance” and “Storage pool for higher flexibility” with the performance pool “better performance but less storage management flexibility” –unfortunately the doc I was looking at didn’t link to what this “storage management flexibility” refers to.

So I decided to just go and click the create storage pool button and see what happens. The popup then told me that the “flexible” pool is the one that supports SHR so I chose that option.

I gave the pool a not very original name of “MainPool” and chose SHR-2 as the RAID type. Then I proceed through the wizard and selected the 4 drives I installed to be part of this pool.

Next I clicked on the create new volume button and chose the storage pool I just created. I set the volume size to max because I only want 1 volume for all the 4 drives and then I was offered the choice of file system: Btrfs or ext – I went with the Btrfs option as it was the recommended option..

Once all this was done the NAS started running a parity consistency check check on the drives.

Setting Up A Share

Now the pool and volume are up and running it’s time to store some files!

I went to the Shared Folder Creation wizard and created a test share and then setup read/write permissions for myself.

Now heading over to Windows File Explorer and navigating to the NAS I had to provide credentials which I did for the user I created earlier:

Connecting to Synology Shared Folder in Windows

Now I can navigate to the Test1 share and create my first NAS-ed file :)

Setup Summary and First Impressions

One thing to bear in mind is that setting up a NAS is not the same as just plugging in an external USB. The Synology DS1618+ offers loads of configuration options and other than a short stumble where I learned about Storage Pools and Volumes the process was pretty painless. I now have the ability to store and retrieve files from anywhere in the house and also know that even if 2 of the 4 hard disks failed I would not lose data.

At this point I have not setup any backups so I won’t be putting any critical files on the NAS yet, I’m also looking forward to setting up things such as Cloud Sync that will sync Dropbox, Onedrive, etc to the NAS – at the moment due to smaller SSD sizes on my machines I’m having to make use of Dropbox selective sync all the time which is a bit annoying – having my entire Dropbox account on my local network will hopefully make things a lot nicer!.

I’m also looking forward to playing with the Synology Docker container support.


Installing and Configuring a UPS with Windows 10

The power grid at my home office is sometimes unreliable. In the last year there have been several power outages ranging from several hours to transient outages of a few seconds.

My main PC is a silent desktop which means (unlike a laptop) has no resilience to power outages. This is where an external uninterruptable power supply (UPS ) comes in handy. A UPS is like a big battery that gets charged from main power, but when there is an outage the battery kicks in and provides power to connected devices.

When choosing a UPS, generally speaking, the more expensive they are the longer they can provide power to connected devices (or provide the same or more power for a longer time). Having researched typical power consumptions and armed with the knowledge that my PC uses SSDs, is fan-less, and does not have a high-powered GPU something in the 1000-1500 VA range was required. My main requirement was the ability to save work and safely shut down the PC before losing all power. If I had more complex energy requirements I would have first purchased a power meter to measure how much power my devices were using before choosing the UPS.

Installing the UPS

Once I understood the approximate power requirements, I selected the Smart-UPS 1000VA LCD 230V from APC.

APC Smart-UPS 1000VA LCD 230V Front

The rear of the unit consists of a number of sockets, for the outputs there are 2 distinct groups that can be configured differently. For example the main group can have the PC and one of the monitors connected. The secondary power group can have non-essential devices attached, in my case the powered studio monitor speakers. The UPS was configured to turn off the secondary group if there is a power outage but after a 15 second delay; this will help with short transient outages. The main group will remain on for as long as the UPC battery has power. There are many different ways to configure this UPS by using the LCD display and front buttons, including the ability to enable/disable audible notifications.

APC Smart-UPS 1000VA LCD 230V rear panel

The rear panel also has a USB connector that can be connected to the PC.

Configuring Windows 10 Power Settings for a UPS

Once everything had been connected (including the UPS-PC USB cable) it can all be switched on. Once the UPS battery is fully charged, turning off the main power at the power outlet causes the UPS to switch to battery power, the PC and single monitor stay on and 15 seconds later the speakers turn off (to save power). Once on battery, the PC and monitor draw about 50W of power and the estimated run time according to the UPS LCD  is about 2 hours.

Because of the USB connection to the PC, Windows 10 also displays the battery status in the system tray:

Windows 10 UPS Battery status

If a power outage occurs when using the PC, once the battery gets low I can manually shutdown the PC to prevent damage/data loss. If however the PC is unattended at the time, I still want it to be safely shutdown.

To do this in Windows 10, type “power & sleep settings” in the start menu and configure the basic settings. From here, “Additional power settings can be opened” and power plans customized. Once in the plan settings, the “Change advanced power settings” can be selected to get down into the fine details:

Opening additional power settings

Once in the detailed Power Options dialog, in additional to other settings I opened the Battery section and changed the critical battery level to be 20% and the critical battery action to Hibernate. I also modified some o the other battery settings. 20% for critical is very conservative as I wanted to hibernate the PC with plenty of UPS battery capacity remaining.

Hibernating Windows 10 when critical UPS battery level reached

Now when on UPS battery power, Windows will warn me when the battery gets low (I configured this to be 40%) and then auto-hibernate at 20% battery.

It’s a great feeling to know that even when there is a storm blowing in that I will not lose any work and that my main PC hardware is protected from surges and unexpected power loss.


The Joys of Silence

I recently took possession of new desktop PC. As a Pluralsight author one of the unique considerations when choosing a new machine was generated noise. After some research I settled on sourcing the computer from a UK company called

NoFan PC case from front

Initially when I started researching what to buy I had assumed that I would pay some performance penalty as I wanted a CPU with fan-less cooling and I didn’t want the additional complexity of something like water cooling.

As the following image shows, I was able to get a quad core Skylake (Core i7 6700K 4.0GHz) without requiring a fan:

Nofan CR-95C Pearl Black IcePipe 95W Fanless CPU Cooler

The humongous thing in the preceding image is a Nofan CR-95C Pearl Black IcePipe 95W Fanless CPU Cooler. This fan-less CPU cooler is based on thermal heatpipes that are able to transfer heat away from the processor, the heat then being dissipated by the huge surface area of the “fins”.

Nofan CR-95C Pearl Black IcePipe 95W Fanless CPU Cooler

The case itself is a Nofan CS-80 Fanless Computer Case coupled with a Nofan P-500A Silent 500W Fanless 80+ GOLD PSU. The case features a vent at the top of the case above the CPU cooler to aid in convection.

In use, the PC is completely silent, no fan noise or electrical hum – the only noise emitted is if you are used the optical drive.

Prior to this machine I was using and was very happy with a Lenovo laptop though under load the fan noise was becoming a little distracting – in all fairness it was an aging machine that had been an 8 hour a day workhorse for a few years.

It’s amazing that once you’ve experienced the joy of completely silent computing, going back to using machines with fans seems archaic. No doubt we’ll eventually have silent, high-performance, fan-less laptops – though the small form factor will present some hard thermal dissipation challenges.

Full hardware specs:

  • Nofan CS-80 Fanless Computer Case
  • Gigabyte GA-Z170XP-SLI LGA1151 ATX Motherboard
  • Intel 6th Gen Core i7 6700K 4.0GHz 91W HD 530 8MB Quad Core CPU
  • Corsair DDR4 Vengeance LPX 32GB (2x16GB) 2400MHz Memory Kit
  • Nofan CR-95C Pearl Black IcePipe 95W Fanless CPU Cooler
  • Nofan P-500A Silent 500W Fanless 80+ GOLD PSU
  • Samsung 950 PRO M.2 512GB NVMe SSD
  • Samsung 850 EVO 250GB 2.5in Solid State Drive
  • Pioneer DVR-221LBK DVD and CD Reader/re-writer
  • Gigabyte Dual Band Wireless-AC GC-WB867D-I Wi-Fi/Bluetooth Card
  • Gigabyte GC-TPM Trusted Platform Module


The Complete Beginners Guide to Hello World using C# .Net and Mono on Raspberry Pi

Disclaimer: some of the software used below is pre-release, use at your own risk...

This article assumes basic knowledge of writing C# and using Visual Studio - it doesn't assume any prior knowledge of Raspberry Pi or Linux.

My Parts List

You can find a list of verified peripherals here, below are the specifics of what I'm using successfully:

  • Raspberry Pi Model B (from element14 Australia)
  • 1 metre high speed HDMI lead (from element14 Australia)
  • Microsoft Comfort Curve 3000 USB keyboard;
  • Logitech M100 USB mouse;
  • SanDisk 16GB Ultra SDHC Card, Class 10, "up to 30 MB/s 200X"
  • Nokia AC-USB phone charger (output: DC 5 volt 1 amp*)
  • Cat 5 Ethernet cable (wired to Belkin wireless bridge/extender)

* It's important to have a sufficiently powerful supply.

Preparing the Operating System

Download Soft-float Debian “wheezy” image from

Extract the .img from the zip file.

Download Win32 Disk Imager (make sure you get the correct link as there's lots of advertising and other download links on the page).