Installing the Unifi Controller on a Synology Nas in 5 minutes

If you have Unifi network gear you also need the Unifi Controller. And it is best to keep the controller running 24/7, so where are you going to install it? If you have a Synology Nas then you could use a Docker Image to run the Unifi Controller. In this article, I will guide you through the installation of Docker and Unifi on your Synology in 5 minutes.

Before we can start we need to make sure that your Synology supports Docker. You can check this in two easy ways:

  1. Login to your Synology and go to the Package Center, search in the top left corner for Docker. If it doesn’t return any results, then Docker isn’t supported for your model
  2. On the website of Synology, you will find information about the add-on Docker and which models support it. Check if your model is listed there under the applied model’s section.

If you Synology isn’t supported you can also go for the Raspberry Pi solution or check out the Unifi Cloud Key

Installing Docker on your Synology

First, we are going to install Docker. Docker allows you to run applications in containers. The advantage of containers is that a developer can create a package, in this case, the Unifi Controller, with all the parts it needs (like Java and MongoDB). Leaving the user with only downloading and starting the image up inside the container. This way other application on the same machine won’t be harmed.

Install Docker on Synology NAS

  1. Login to your Synology Nas with an admin user.
  2. Open the Package Center
  3. Search in the top left corner for Docker
  4. Install Docker (blue whale icon)

Installing the Unifi Controller

Installing the Unifi Controller is just a few mouse clicks. We are going to download the Unifi Controller image (700Mb) and configure the Docker Container for it.

Downloading the image

Docker starts up after you installed it. Go the register on the left side and search for Unifi.

Installing Unifi Controller on Synology

Starting the Unifi Container Image

Select jacobalberty/unifi and click on download. It may take a few minutes to download the image, you can see the progress on the Image tab. When the download is complete, select the image and click on Launch

Launch Unifi Controller Docker on Synology

Configure the Unifi Container

After you clicked on Launch, the container configuration wizard will start. We need to change some settings so we can reach the Unifi Controller from another computer (then only from the Synology), store the files somewhere and limit the resources.

General Settings

Configuring Unifi Controller for Synology

  1. Give the Container a name, like Unifi-Controller. Something you will recognize later.
  2. Enable resource limitation, this way the Unifi Controller can’t use all the resources of the Synology. This is really recommended if you are running more applications on your NAS.
  3. Click on Advanced Settings

Advanced Settings

Unifi Controller Docker Auto Restart

On the next screen, enable Auto-restart. This way the Unifi Controller will be restarted when your Synology turns is rebooted (after an update for example)

Set Disk Volume

Create Volume on Synology for Unifi Controller

Click on the tab Volume. We need to map the file storage of the Docker to the disk of the Synology.

  1. Click on Add Folder
  2. Select docker
  3. Click Create Folder
  4. Name it Unifi
  5. Click on Select

Next, we need to map the newly created folder. In the column, Mount Path enter /unifi

Network Settings

Unifi Controller Same Network as Synology

Click on the network tab and select Use the same network as Docker Host. This way we can reach the Unifi Controller on the same IP Address as our Synology NAS.

Environment Settings

Advanced Unifi Controller settings for Synology

  1. Click on the last tab, Environment.
  2. Scroll all the way down and change the following values:
    BIND_PRIV False
    RUNAS_UID0 FalseClick on Apply
  3. Click on Next and Apply again.

The Unifi Controller will now start and is accessible on your Synology address on port 8443. So if you can open your NAS on https://192.168.1.2 then you can find the Unifi Controller on https://192.168.1.2:8443. Make sure you put https in front of it.

Configure your Synology Firewall

By default, the Synology firewall is turned on. This will prevent you from accessing and using the Unifi Controller. You don’t need to turn the firewall off, you only need to open some ports to allow traffic to the Unifi Controller. You can do this as follows

  1. Open the Control Panel
  2. Select Security
  3. Select Firewall

Open Synology Firewall for Unifi Controller

Here you will see the Enable Firewall is turned on. Below that you will find the Firewall Profile. Click on Edit Rules to open the ports for the Unifi Controller.

Adding Unifi Controller Ports to Synology Firewall

  1. Click on Create to add a Firewall Rule
  2. Select under Ports > Custom and again Custom (button)
  3. Protocol is TCP
  4. Ports (Separate with commas):  8080,8443,8843,8880,6789
  5. Click Ok and Ok
  6. Click on Create again
  7. Select under Ports > Custom and again Custom (button)
  8. Protocol is UDP 
  9. Ports (Separate with commas):  3478,10001
  10. Click Ok (3x times)

You should now be able to access the Unifi Controller. If this controller is still not accessible then it might be necessary to restart your Synology NAS. The Unifi Controller will start automatically after the reboot.

Updating the Unifi Controller Container

Updating the Unifi Controller on the Synology is a little bit different compared to a Linux/Windows/Rasberry Pi installation. You can’t just download the latest version and run the installer inside the Docker container. There is no auto-update feature either, so when a new version comes out, you will need to download a new version of the Docker Unifi Image. Tip: subscribe to my email list in the sidebar to receive a notification when a new version is available!

Download Unifi Controller Backup

Before you start with updating you should always make and download a backup of your Unifi Controller. Login to the controller an select Maintenance. Scroll down to Backup and download the backup file.

Downloading the latest version

To update the controller you need to follow these steps:

  1. Open Docker on the Synology
  2. Click on Registry and search again for Unifi (just like we did during the installation)
  3. Select the jacobalbert/unifi and click download.
  4. Wait until the download is completed (check the image tab or wait for the notification)

Updating the container

When the download is finished we can start with updating or actually replacing, the Docker image. In Docker select Container:

Turn Unifi Container off

  1. Stop the Unifi Controller container by flipping the on-off switch. Wait until the status is changed to stop
  2. Select the Unifi Controller container again
  3. Click on Action and select Clear
  4. Acknowledge that all the data in the container will be lost. (Settings and data are saved in the mapped folder)
  5. Start the container again by filliping the on-off switch

You can now log in again on your Unifi Controller.

Alternatives

If you Synology doesn’t support Docker or you are planning to buy a new Synology NAS, then make sure you check the Docker Add-On page at the Synology website to see if it support Docker. For home networks, the Synology NAS DS218+ is a good and affordable choice. It will cost around $ 300 on Amazon for the diskless version. Don’t be tempted to go for the cheaper version, they don’t support Docker.

A cheaper alternative to run the Unifi Controller is a Rasberry Pi or the Unifi Cloud Key. The Cloud key cost only a third on Amazon of the Synology NAS and you only need to power it up to use the controller software.

Conclusion

If you have any questions just drop a comment below. Make sure you sign up for the newsletter to stay up-to-date with the Unifi Controller software.

See also:

Get more stuff like this

IT, Office365, Smart Home, PowerShell and Blogging Tips

I hate spam to, so you can unsubscribe at any time.

8 thoughts on “Installing the Unifi Controller on a Synology Nas in 5 minutes”

  1. Hi,

    thank you for the excellent tutorial. Could you help me with 2 questions please:
    1. why should be those 2 parameters set to false?
    2. I need to chage the communication ports, as the 8443 port is already used by different application, is it possible to change it somehow within the docker?

    Thank you

    David

    • Hi David,

      RUNAS_UID0 is set to false so the image will run as a special unifi user. Otherwise, it will run as root. The BIND_PRIV variable can be used to bind port below the 1024. But on some docker filesystems, this may not work.

      To change the ports, you should be able to change this in the system.properties file. You will find it in the File Station/docker/Unifi/data. More info about changing ports here.

      • Thank you for the reply.
        I wrote the path /Unifi and it did not save any files to the folder, when I changed it to /unifi files and folders showed up in the docekr/Unifi.

        However I have one more problem. When I start the container and restore the settings from backup everything works fine for a while. I can connect to the controller from the phone and everything works. When I quit the app on phone and reopen the controller on iMac it shows no devices and no clients. It looks like it does not remember the settings.

        Could you help me please? Homebridge container is running in the docker as well.

        In the terminal of the container I found following errors:
        Feb 12, 2019 7:31:26 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
        INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused (Connection refused)
        Feb 12, 2019 7:31:26 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
        INFO: Retrying request

        • Hi David,

          I looks like you need to update Java or change the path to your Java installation. You can try using this guide to update Java in your Docker, or try to update the path:


          Please edit the file "unifi" in /etc/default/

          For example:
          #JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt => old
          JAVA_HOME=/usr/lib/jvm/java-8-oracle => new

  2. Great information… Worked for me the very first time… I would however like a little more info on doing upgrades to my controller.

    How often do you update the links? And does the beta download correspond with Ubiquiti’s beta cycle?

    The reason I ask is I wanted to try the Beta controller to see what improvements it may contain and was not sure if your download link contained the latest beta code.

    Thanks in advance

    • Hi David,

      I don’t link to the beta downloads. I check the versions one in the month and update them if necessary. You can subscribe to the email list, then you will receive a notification when a new version is available.

  3. Hallo Ruud,

    danke für die gute Anleitung (Unifi Controllers/ Synology Nas). Nichtsdestotrotz habe ich ein entscheidendes Problem!
    Im Docker Container kann man sehen das der Controller funktioniert, aber ein Zugriff auf die Benutzeroberfläche ist nicht möglich.
    https://192.168.0.33:8443
    Die Controller Oberfläche öffnet sich nicht, sondern eine Collection Listing die einen Strukturbaum ähnelt. In der „Collection Listing“ befindet sich kein Eintrag hinsichtlich Unifi Controller.
    Gerne kann ich Ihnen hierzu auch Screenshots zusenden.

    Vielleicht können sie mir helfen, ich wäre Ihnen dankbar.

    Mit freundlichen Grüßen

    Frank Mauritz

    Hello Ruud,

    thanks for the good instructions (Unifi Controllers / Synology Nas). Nevertheless, I have a crucial problem!
    In the Docker container you can see that the controller is working, but access to the Unifi Controller is not possible.
    https://192.168.0.33:8443
    The Unifi Controller does not open, but a collection listing similar to a tree structure. In the “Collection Listing” there is no entry regarding Unifi Controller.
    I am happy to send you screenshots as well.

    Maybe you can help me, I would be grateful.

    Yours sincerely

    Frank Mauritz

    • Hi Frank,

      Do you have anything else running on your Synology that might be using the same port? You can find my contact details on the about page to send me a screenshot.

Leave a Comment