latest
is now tracking unifi 6.0.x as of 2020-10-20.
All tags are now multiarch capable with amd64
, armhf
, and arm64
builds included.
armhf
for now uses mongodb 3.4, I do not see much of a path forward for armhf
due to the lack of mongodb support for 32 bit arm, but I will
support it as long as feasibly possible, for now that date seems to be expiration of support for ubuntu 18.04.
It is suggested you start running this as a non root user. The default right now is to run as root but if you set the docker run flag --user
to unifi
then the image will run as a special unfi user with the uid/gid 999/999. You should ideally set your data and logs to owned by the proper gid.
You will not be able to bind to lower ports by default. If you also pass the docker run flag --sysctl
with net.ipv4.ip_unprivileged_port_start=0
then you will be able to freely bind to whatever port you wish. This should not be needed if you are using the default ports.
Unifi uses mongo store its data. Mongo uses the fsync() system call on its data files. Because of how docker for windows works you can't bind mount /unifi/db/data
on a docker for windows container. Therefore -v ~/unifi:/unifi
won't work.
Discussion on the issue.
Tag | Description |
---|---|
latest , stable-6 , 6.0 |
Tracks UniFi stable version - 6.0.45 as of 2021-01-26 Change Log 6-0-45 |
latest-5 , stable-5 , 5.0 |
Tracks UniFi 5.14 stable version - 5.14.23 as of 2020-09-14 |
Version | Latest Tag |
---|---|
6.0.x | 6.0.43-rc |
These tags generally track the UniFi APT repository. We do lead the repository a little when it comes to pushing the latest version. The latest version gets pushed when it moves from release candidate
to stable
instead of waiting for it to hit the repository.
In adition to these tags you may tag specific versions as well, for example jacobalberty/unifi:5.6.40
will get you unifi 5.6.40 no matter what the current version is. Release candidates now exist both under the rc
tag and for tags with the extension -rc
ie jacobalberty/unifi:5.6.18-rc
. It is advised to use the specific versions as the rc
tag may jump from 5.6.x to 5.8.x then back to 5.6.x as new release candidates come out.
This is a containerized version of Ubiqiti Network's Unifi Controller.
The following options may be of use:
- Set the timezone with
TZ
- Bind mount the
data
andlog
volumes
It is suggested that you include --init to handle process reaping Example to test with
mkdir -p unifi/data
mkdir -p unifi/log
docker run --rm --init -p 8080:8080 -p 8443:8443 -p 3478:3478/udp -e TZ='Africa/Johannesburg' -v ~/unifi:/unifi --name unifi jacobalberty/unifi:stable
Note you must omit -v ~/unifi:/unifi
on windows, but you can use a local volume e.g. -v unifi:/unifi
(omit the leading ~/) to persist the data on a local volume.
A compose file has been included that will bring up mongo and the controller, using named volumes for important directories.
Simply clone this repo or copy the docker-compose.yml
file and run
docker-compose up -d
The default example requires some l3 adoption method. You have a couple options to adopt.
Run UniFi Docker and open UniFi in browser. Go under Settings -> Controller and then enter the IP address of the Docker host machine in "Controller Hostname/IP", and check the "Override inform host with controller hostname/IP". Save settings and restart UniFi Docker container.
The quickest one off method is to ssh into the access point and run the following commands:
mca-cli
set-inform http://<host_ip>:8080/inform
You can see more options on the UniFi website
You can also enable layer 2 adoption through one of two methods.
If you launch the container using host networking (With the --net=host
parameter on docker run
) Layer 2 adoption works as if the controller is installed on the host.
It is possible to configure the macvlan
driver to bridge your container to the host's networking adapter. Specific instructions for this container are not yet available but you can read a write-up for docker at collabnix.com/docker-17-06-swarm-mode-now-with-macvlan-support.
The beta
image has been updated to support package installation at run time. With this change you can now install the beta releases on more systems, such as Synology. This should open up access to the beta program for more users of this docker image.
If you would like to submit a new feature for the images the beta branch is probably a good one to apply it against as well. I will be cleaing up the Dockerfile under beta and gradually pushing out the improvements to the other branches. So any major changes should apply cleanly against the beta
branch.
Using the Beta build is pretty easy, just use the jacobalberty/unifi:beta
image and add -e PKGURL=https://dl.ubnt.com/unifi/5.6.30/unifi_sysvinit_all.deb
to your usual command line.
Simply replace the url to the debian package with the version you prefer.
This is just as easy when using version 2 of the docker-compose.yml file format.
Under your containers service definition instead of using image: jacobalberty/unifi
use the following:
image: jacobalberty/unifi:beta
environment:
PKGURL: https://dl.ubnt.com/unifi/5.6.40/unifi_sysvinit_all.deb
Once again, simply change PKGURL to point to the package you would like to use.
This is a single monolithic volume that contains several subdirectories, you can do a single volume for everything or break up your old volumes into the subdirectories
Old: /var/lib/unifi
This contains your UniFi configuration data.
old: /var/log/unifi
This contains UniFi log files
old: /var/cert/unifi
To use custom SSL certs, you must map a volume with the certs to /unifi/cert
For more information regarding the naming of the certificates, see Certificate Support.
This is an entirely new volume. You can place scripts you want to launch every time the container starts in here
Run information, in general you will not need to touch this volume. It is there to ensure UniFi has a place to write its PID files
These are no longer actually volumes, rather they exist for legacy compatibility. You are urged to move to the new volumes ASAP.
New name: /unifi/data
New name: /unifi/log
Default: 8080
This is the HTTP port used by the Web interface. Browsers will be redirected to the UNIFI_HTTPS_PORT
.
Default: 8443
This is the HTTPS port used by the Web interface.
Default: unset
Controller outputs logs to stdout in addition to server.log
TimeZone. (i.e America/Chicago)
used to set max thread stack size for the JVM
Ex:
--env JVM_MAX_THREAD_STACK_SIZE=1280k
Default: unset
Used to start the JVM with additional arguments.
Default: unset
Java Virtual Machine (JVM) allocates available memory.
For larger installations a larger value is recommended. For memory constrained system this value can be lowered.
Default 1024M
These variables are used to implement support for an external MongoDB server and must all be set in order for this feature to work. Once all are set then the configuration file value for db.mongo.local
will automatically be set to false
.
Maps to db.mongo.uri
.
Maps to statdb.mongo.uri
.
Maps to unifi.db.name
.
While micro-service patterns try to avoid running multiple processes in a container, the unifi5 container tries to follow the same process execution model intended by the original debian package and it's init script, while trying to avoid needing to run a full init system.
dumb-init
has now been removed. Instead it is now suggested you include --init in your docker run command line. If you are using docker-compose you can accomplish the same by making sure you use version 2.2 of the yml format and add init: true
to your service definition.
unifi.sh
executes and waits on the jsvc process which orchestrates running the controller as a service. The wrapper script also traps SIGTERM to issue the appropriate stop command to the unifi java com.ubnt.ace.Launcher
process in the hopes that it helps keep the shutdown graceful.
You may now place init scripts to be launched during the unifi startup in /usr/local/unifi/init.d to perform any actions unique to your unifi setup. An example bash script to set up certificates is in /usr/unifi/init.d/import_cert
.
To use custom SSL certs, you must map a volume with the certs to /unifi/cert
They should be named:
cert.pem # The Certificate
privkey.pem # Private key for the cert
chain.pem # full cert chain
If your certificate or private key have different names, you can set the environment variables CERTNAME
and CERT_PRIVATE_NAME
to the name of your certificate/private key, e.g. CERTNAME=my-cert.pem
and CERT_PRIVATE_NAME=my-privkey.pem
.
For letsencrypt certs, we'll autodetect that and add the needed Identrust X3 CA Cert automatically. In case your letsencrypt cert is already the chained certificate, you can set the CERT_IS_CHAIN
environment variable to true
, e.g. CERT_IS_CHAIN=true
. This option also works together with a custom CERTNAME
.
This list is empty for now, please add your suggestions.