jacobalberty/unifiThis repo contains a Dockerized version of Ubiqiti Network's Unifi Controller.
Why bother? Using Docker, you can stop worrying about version hassles and update notices for Unifi Controller, Java, or your OS. A Docker container wraps everything into one well-tested bundle.
To install, a couple lines on the command-line starts the container. To upgrade, just stop the old container, and start up the new. It's really that simple.
This container has been tested on Ubuntu, Debian, macOS, Windows, and even Raspberry Pi hardware.
The current "latest" version is Unifi Controller 7.1.68. There are currently no hot-fix or CVE warnings affecting Unifi Controller.
First, install Docker on the "Docker host" - the machine that will run the Docker and Unifi Controller software. Use any of the guides on the internet to install on your Docker host. For Windows, see the Microsoft guide for installing Docker.
Then use the following steps to set up the directories and start the Docker container running.
One-time setup: create the unifi directory on the Docker host.
Within that directory, create two sub-directories: data and log.
bashcd # by default, use the home directory mkdir -p unifi/data mkdir -p unifi/log
Note: By default, this README assumes you will use the home directory on Linux, Unix, macOS. If you create the directory elsewhere, read the Options section below to adjust.)
Each time you want to start Unifi, use this command. Each of the options is described below.
bashdocker run -d --init \ --restart=unless-stopped \ -p 8080:8080 -p 8443:8443 -p 3478:3478/udp \ -e TZ='Africa/Johannesburg' \ -v ~/unifi:/unifi \ --user unifi \ --name unifi \ jacobalberty/unifi
In a minute or two, (after Unifi Controller starts up) you can go to [***] to complete configuration from the web (initial install) or resume using Unifi Controller.
Important: Two points to be aware of when you're setting up your Unifi Controller:
To change options, stop the Docker container then re-run the docker run... command
above with the new options.
Note: The docker rm unifi command simply removes the "name" from the previous Docker image.
No time-consuming rebuild is required.
bashdocker stop unifi docker rm unifi
All the configuration and other files created by Unifi Controller
are stored on the Docker host's local disk (~/unifi by default.)
No information is retained within the container.
An upgrade to a new version of Unifi Controller simply retrieves a new Docker container,
which then re-uses the configuration from the local disk.
The upgrade process is:
docker run... with the newer container tag (see Supported Tags below.)The options for the docker run... command are:
-d - Detached mode: Unifi-in-Docker runs in the background--init - Recommended to ensure processes get reaped when they die--restart=unless-stopped - If the container should stop for some reason,
restart it unless you issue a docker stop ...-p ... - Set the ports to pass through to the container.
-p 8080:8080 -p 8443:8443 -p 3478:3478/udp
is the minimal set for a working Unifi Controller.-e TZ=... Set an environment variable named TZ with the desired time zone.
Find your time zone in this
list of timezones.-e ... See the Environment Variables
section for more environment variables.-v ... - Bind the volume ~/unifi on the Docker host
to the directory /unifiinside the container.
These instructions assume you placed the "unifi" directory in your home directory.
If you created the directory elsewhere, modify the ~/unifi part of this option to match.
See the Volumes discussion for other volumes used by Unifi Controller.--user unifi - Run as a non-root user. See the Run as non-root User discussion belowjacobalberty/unifi - the name of the container to use.
The jacobalberty... image is retrieved from Dockerhub.
See the discussion about Supported Tags below.You can choose the version of Unifi Controller in the docker run ... command.
In Docker terminology, these versions are specified by "tags".
For example, in this project the container named jacobalberty/unifi
(with no "tag")
provides the most recent stable release.
See the table below for the current version.
The rc tag (for example, jacobalberty/unifi:rc)
uses the most recent Release Candidate from the UniFi APT repository.
You may also specify a version number (e.g., jacobalberty/unifi:stable6)
to get a specific version number, as shown in the table below.
Note: In Docker, specifying an image with no tag
(e.g., jacobalberty/unifi) gets the "latest" tag.
For Unifi-in-Docker, this uses the most recent stable version.
| Tag | Description | Changelog |
|---|---|---|
latest, 7.1.68 | Current Stable: Version 7.1.68 as of 2022-07-29 | Change Log 7.1.68 |
rc | Release Candidate: 7.2.92-rc as of 2022-07-29 | Change Log 7.2.91-rc |
stable6 | Final stable version 6 (6.5.55) | Change Log 6.5.55 |
stable5 | Final stable version 5 (5.4.23) | Change Log 5.14.23 |
All available containers now support multiarch 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.
For your Unifi devices to "find" the Unifi Controller running in Docker, you MUST override the Inform Host IP with the address of the Docker host computer. (By default, the Docker container usually gets the internal address 172.17.x.x while Unifi devices connect to the (external) address of the Docker host.) To do this:
docker stop ... and docker run ... commands.See Side Projects for other techniques to get Unifi devices to adopt your new Unifi Controller.
Unifi looks for the /unifi directory (within the container)
for its special purpose subdirectories:
/unifi/data This contains your UniFi configuration data. (formerly: /var/lib/unifi)
/unifi/log This contains UniFi log files (formerly: /var/log/unifi)
/unifi/cert Place custom SSL certs in this directory.
For more information regarding the naming of the certificates,
see Certificate Support. (formerly: /var/cert/unifi)
/unifi/init.d
You can place scripts you want to launch every time the container starts in here
/var/run/unifi
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.
/var/lib/unifi New name: /unifi/data/var/log/unifi New name: /unifi/logYou can pass in environment variables using the -e option when you invoke docker run...
See the TZ in the example above.
Other environment variables:
UNIFI_HTTP_PORT
This is the HTTP port used by the Web interface. Browsers will be redirected to the UNIFI_HTTPS_PORT.
Default: 8080
UNIFI_HTTPS_PORT
This is the HTTPS port used by the Web interface.
Default: 8443
PORTAL_HTTP_PORT
Port used for HTTP portal redirection.
Default: 80
PORTAL_HTTPS_PORT
Port used for HTTPS portal redirection.
Default: 8843
UNIFI_STDOUT
Controller outputs logs to stdout in addition to server.log
Default: unset
TZ
TimeZone. (i.e America/Chicago)
JVM_MAX_THREAD_STACK_SIZE
Used to set max thread stack size for the JVM
Example:
--env JVM_MAX_THREAD_STACK_SIZE=1280k
as a fix for [***]
LOTSOFDEVICES
Enable this with true if you run a system with a lot of devices
and/or with a low powered system (like a Raspberry Pi).
This makes a few adjustments to try and improve performance:
See the Unifi support site for an explanation of some of those options. Default: unset
JVM_EXTRA_OPTS
Used to start the JVM with additional arguments.
Default: unset
JVM_INIT_HEAP_SIZE
Set the starting size of the javascript engine for example: 1024M
Default: unset
JVM_MAX_HEAP_SIZE
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
The Unifi-in-Docker container exposes the following ports.
A minimal Unifi Controller installation requires you
expose the first three with the -p ... option.
See UniFi - Ports Used for more information.
The default container runs Unifi Controller as root.
The recommended docker run... command above starts
Unifi Controller so the image runs as unifi (non-root)
user with the uid/gid 999/999.
You can also set your data and logs directories to be
owned by the proper gid.
Note: When you run as a non-root user,
you will not be able to bind to lower ports by default.
(This would not necessary if you are using the default ports.)
If you must do this, also pass the
--sysctl net.ipv4.ip_unprivileged_port_start=0
option on the docker run... to bind to whatever port you wish.
To use custom SSL certs, you must map a volume with the certs to /unifi/cert
They should be named:
shellcert.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 document describes everything you need to get Unifi-in-Docker running. The Side Projects and Background Info page provides more about what we've learned while developing Unifi-in-Docker.
This list is empty for now, please add your suggestions.
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务