Running Unifi Network Application in Docker

Recently I tried to use the Unifi Network Application to set up some new UAP-AC-PRO access points, but found myself unable to get it working reliably on my M1 MacBook Pro. Ultimately, these APs were for a remote install and I didn't need remote management of them, just for them to broadcast an SSID and work.

After much experimentation, I found the easiest way to run the Unifi Network Application was through Docker.

docker run -d --init \
   --restart=unless-stopped \
   -p 8080:8080 -p 8443:8443 -p 3478:3478/udp \
   -e TZ='Europe/London' \
   -v ~/unifi:/unifi \
   --user unifi \
   --name unifi \
   jacobalberty/unifi

After launching this container and allowing it to download all required assets (some are quite big so it does take a while to launch on a normal DSL connection), you can get to the controller IP using https://localhost:8443/

As the controller is running on a local network bridge with its own IP range (as per standard docker operation), the standard method of Layer 2 Discovery used by Unifi APs won't work, so newly connected APs won't show up for adoption in the web interface without a little persuasion.

In order to get the new AP discovered by our controller, we need to override the "Inform Host IP", which gives the AP a hint of where our controller resides.

To do this, first we need to change a setting in our controller. Navigate to the web interface as above and go to Settings -> System -> Other Configuration -> Override Inform Host. Check the "Override" box and put in the address of your laptop (or machine running Docker) on which the controller resides.

GitHub - jacobalberty/unifi-docker: Unifi Docker files
Unifi Docker files. Contribute to jacobalberty/unifi-docker development by creating an account on GitHub.

More details are available here about the Docker image and Inform Host setting

After factory resetting your AP (after boot hold down the reset button for 5 seconds until the LED changes colour), wait for it to reboot and then connect to it via SSH.

[find the IP of your AP using LanScan/Angry IP Scanner]

ssh ubnt@192.168.1.128 [replace with your AP IP]
ubnt@192.168.1.128's password: 

[type 'ubnt' (default credentials after reset are ubnt/ubnt)]
[replace the IP below with the IP of your laptop/docker host]

> set-inform http://192.168.1.4:8080/inform

Adoption request sent to.... (etc)

Give it a few seconds, and the AP should show up in your controller. You can now adopt it and use the controller as you would normally.

I particularly like this method of running Unifi Controller as it enables it to be portable across platforms, from Raspberry Pi's, to small linux machines, to just being able to run it on a hypervisor alongside other applications.