Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save markwell-ch/11431ed56a780e8e521e0c88b703c167 to your computer and use it in GitHub Desktop.
Save markwell-ch/11431ed56a780e8e521e0c88b703c167 to your computer and use it in GitHub Desktop.
Running Unifi Network Controller as a container in MikroTik ROSv7 RB5009

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 interface=veth1 logging=yes root-dir=disk1/unifi

Do not mount /config. AS of 7.4rc2, mount still has permission issue. Since we are using root-dir (the router will run out of memory otherwise), the container will persist between restarts anyway.

Start the container

/container/start 0

Monitor container startup 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment