Setting up Unifi Controller in a docker container on a Raspberry Pi for my home network
Preliminaries
The network topology is as follows:
Fiber optic modem <=> TP Link Router <=> TP Link PoE switch <=> 2 Ubiquiti wireless APs
Hard-wire the Pi to the switch, and assign it a static IP address from the router.
Setup UniFi Controller in a docker container on raspberry pi
- Note, this configuration should be done on a Mac that is hard-wired to the switch
SSH to the Pi and install docker (following this)
Install the UniFi docker image as below
# Based on instructions at https://hub.docker.com/r/jacobalberty/unifi
# set up directories
mkdir -p unifi/data
mkdir -p unifi/log
# install unifi container
sudo docker pull jacobalberty/unifi
# run unifi container
sudo docker run -d --init \
--restart=unless-stopped \
-p 8080:8080 -p 8443:8443 -p 3478:3478/udp \
-v ~/unifi:/unifi \
--user unifi \
--name unifi \
jacobalberty/unifi
# confirm that unifi is running
sudo docker ps
- Go to https://ADDRESS:8443/, where ADDRESS is the IP of the Pi assigned earlier (it should match the IP shown with
hostname -I
) - In the UniFi web GUI, either set up a new network or restore from a backup
- To get the Ubiquiti APs to show up in the UniFi GUI:
- Reset each Ubiquiti AP by pressing the reset button on the back for >10 seconds (until lights flash), then power cycle
- In the web GUI, check “Override” next to “Inform Host” in Settings => System => Advanced, and enter the IP of the raspberry pi
- SSH into each Ubiquiti AP (username: ubnt, password: ubnt) and run
set-inform http://ADDRESS:8080/inform
- Find the IPs of the APs by noting the MAC address on the back of each AP, and matching to the MAC addresses in the DHCP client list in the router’s online GUI at 192.168.0.1
- Then in the UniFi web GUI, the APs should appear. Click “Adopt”
- Note after adoption, the ubnt/ubnt credentials no longer work. Instead use the username/password in the Ubiquiti administration interface under Settings → System → Advanced → Device Authentication
Wifi performance
- Set 2.4/5GHz channel widths to 40/80MHz
- See summary of UniFi advanced settings here
Misc Notes
Note if running the docker UniFi container on a mac, go to https://host.docker.internal:8443/ in the browser (make sure 127.0.0.1 host.docker.internal is in /etc/hosts)
Posted by Abraham