To make the most use of your existing investment in a Synology NAS (or any other system that can manage containers) you can use the Docker package to run your UniFi network hardware using a containerised version of the UniFi Controller software. This not only makes your environment both smaller from a physical foot print, but also harnesses your existing capital investment – not to mention makes upgrades so much easier!
Instructions
- First, ensure you have docker installed on your NAS. To do this, head to the “Package Center” and find the “Docker” package and install.
- Once Docker is installed, you now have a virtualisation platform, so we can start work on the container. You will notice that the package creates a default share for docker called “docker” which is where we will need to create our persistent storage. It is important to note, that for this setup the container (which has the application code) sits separately to the persistent storage which makes updates that much easier (more on that later!).
Create a folder in the docker shared folder called “unifi”.
- Now open the Docker application that you installed (it should be on the desktop, else, check the ‘start menu’ at the top of the screen – not quite sure what you call the dropdown menu!).
- From the Docker application head to the “Registry” tab on the left hand side, this is where we will find all the available docker images we can download. You will need to search for “jacobalberty/unifi“. Select the image and click the “Download” button.
- This container will then appear in your “Image” tab, as a list of possible containers you can deploy that have already been downloaded.
- When it has completed downloading, click in the image and click “Launch”, you will then be prompted with a wizard to get the container deployed.
- The first prompt will ask if you want to use an internal network or bridge, I personally choose to bridge the network as this reduces later complexity.
- You will then be asked to name your container and set resource limitations. I chose to call mine “Unifi-Controller” (very original!), and set resource limitations of Medium CPU priority, and 1024MB of memory. You can also set the “Enable auto-restart” if you want the container to auto start with your NAS or if it detects a failure etc.
- In the Advanced settings we will want to change the BIND_PRIV to “False” and RUNAS_UID0 to “False”
- The next prompt will ask if you want to set port mappings – this is where I manually map the external ports for the NAS to the internal Docker container. Should you not do this, you’ll end up with auto assigned ports, which doesn’t seem to play well with the UniFi hardware which by default expects these ports.
- The wizard will then ask if you wish to map a file or folder. We will want to map a folder, which will be the folder we created earlier in the docker share called “unifi”.
- Once you have clicked “next”, review the settings and click “Done”. The docker container should start to run. Head over to;
https://YOUR_NAS:8443
You should now see the UniFi interface loading! Should you have a firewall running on your NAS you may need to add additional rules for the forementioned ports. It can take a little while the for system to boot up the first time, and may show 404 errors, however be patient. If you want to use DHCP discovery with PFSence (or technically any other DHCP server) for your UniFi environment check out this blog post otherwise this post will help with upgrading the container when new software comes out.