Requirement
- USB flash drive - this is where the container filesystem will be persisted
Set-up docker bridge network
/interface bridge add name=docker
Set-up veth
to be used by container
/interface veth add address=172.16.2.2/24 gateway=172.16.2.1 name=veth1
/interface bridge port add bridge=docker interface=veth
Assign IP to the docker bridge
/ip/address add address=172.16.2.1/24 interface=docker network=172.16.2.0
You may optionally set up firewall rules to isolate the docker network.
Configure registry
/container config set registry-url=https://registry-1.docker.io tmpdir=disk1/cache
Set memory limits
/container envs add key=MEM_LIMIT name=unifi value=512
/container envs add key=MEM_STARTUP name=unifi value=256
Probably can still be tuned down.
Define the container
/container add remote-image=linuxserver/unifi-controller:latest envlist=unifi_controller interface=veth1 logging=yes root-dir=disk1/unifi
Do not mount
/config
. AS of 7.4rc2, mount still has permission issue. Since we are usingroot-dir
(the router will run out of memory otherwise), the container will persist between restarts anyway.
Start the container
/container/start 0
Monitor container starup state
/container/print
Add static DNS entries
/ip/dns/static
# default set-inform host
add address=172.16.2.2 name=unifi
# host to use in browser
add address=172.16.2.2 name=unifi.lan
Browse admin panel https://unifi.lan:8443
Credit to @bergnetwork https://youtu.be/2Rq1Dnj2p8E
Update
- v7.4 stable does not include container support
@klausbfrederiksen good catch! Hilarious I missed the most important part lol