goofball222/unifi

By goofball222

Updated 5 days ago

UniFi Docker Container

Image
162

10M+

goofball222/unifi repository overview

y

UniFi Docker Container

Latest Build Status Docker Pulls Docker Stars License

Docker tags:

TagUniFi VersionDescriptionRelease Date
10.4, 10.4-alpine, 10.4-debian, 10.4-ubuntu, latest, latest-alpine, latest-debian, latest-ubuntu10.4.57UniFi Network Application official release2026-05-28
10.5-beta, 10.5-alpine-beta, 10.5-debian-beta, 10.5-ubuntu-beta, latest-beta, latest-alpine-beta, latest-debian-beta, latest-ubuntu-beta10.5.62UniFi Network Application beta/release candidate2026-07-13
10.3, 10.3-alpine, 10.3-debian, 10.3-ubuntu10.3.58UniFi Network Application official release2026-04-28
10.4.5710.4.57Static official release tag/image2026-05-28
10.3.5810.3.58Static official release tag/image2026-04-28
Older Static Tags
TagUniFi VersionDescriptionRelease Date
10.2.10510.2.105Static official release tag/image2026-04-08
10.1.8910.1.89Static official release tag/image2026-03-18
10.0.16210.0.162Static official release tag/image2025-12-14
9.5.219.5.21Static official release tag/image2025-10-13
9.4.199.4.19Static official release tag/image2025-08-28
9.3.459.3.45Static official release tag/image2025-07-31
9.2.879.2.87Static official release tag/image2025-06-10
9.1.1209.1.120Static official release tag/image2025-04-25
9.0.1149.0.114Static official release tag/image2025-02-04
8.6.98.6.9Static official release tag/image2024-11-07
8.5.68.5.6Static official release tag/image2024-10-09
8.4.628.4.62Static official release tag/image2024-09-11
8.3.328.3.32Static official release tag/image2024-07-15
8.2.938.2.93Static official release tag/image2024-06-03
8.1.1278.1.127Static official release tag/image2024-05-03
8.0.288.0.28Static official release tag/image2024-01-25
7.5.1877.5.187Static official release tag/image2023-10-17
7.4.1627.4.162Static official release tag/image2023-07-03
7.3.837.3.83Static official release tag/image2023-01-30
7.2.977.2.97Static official release tag/image2023-02-06
7.1.687.1.68Static official release tag/image2022-08-02
7.0.257.0.25Static official release tag/image2022-03-28
6.5.556.5.55Static official release tag/image2021-12-16
6.4.546.4.54Static official release tag/image2021-09-20
6.2.266.2.26Static official release tag/image2021-06-24
6.1.716.1.71Static official release tag/image2021-03-25
6.0.456.0.45Static official release tag/image2021-01-26
5.14.235.14.23Static official release tag/image2020-08-25
5.13.325.13.32Static official release tag/image2020-07-02
5.12.725.12.72Static official release tag/image2020-05-18
5.11.505.11.50Static official release tag/image2019-10-08
5.6.425.6.42Static official release tag/image2019-05-03


2026-02-11:

10.1 images & static release / tag now default to mongo 8.0. This slightly bumps the old MongoDB deprecation date up from 2026-02-15 to 2026-02-11.

2025-11-12:

10.0 beta images now introduce a warning about MongoDB deprecation and 90 seconds of startup delay if the database mode is still "internal" and old embedded versions are detected.

Anyone still running new images with old MongoDB versions and "internal" databases should work out an upgrade plan/path ASAP, current planned deprecation date is 2026-02-15.

In addition to the Alpine based version, tags now available without MongoDB built in: latest-nomongo, latest-nomongo-beta, latest-ubuntu-nomongo, latest-ubuntu-nomongo-beta, latest-debian-nomongo, latest-debian-nomongo-beta, 10.1-nomongo, 10.1-nomongo-beta, 10.1-ubuntu-nomongo, 10.1-ubuntu-nomongo-beta, 10.1-debian-nomongo, 10.1-debian-nomongo-beta

Please test and report any bugs, or issues on GitHub

NOTE: Alpine tags DO NOT contain any internal MongoDB binaries. You must connect them to an external Mongo DB container or other host instance.


For security/attack surface reduction the container is configured to run the UniFi processes as an internal user & group unifi having a pre-set UID & GID of 999. The container will attempt to adjust permissions on mapped volumes and data to match before dropping privileges to start the UniFi Java and Mongo processes. If the container is being run with a different Docker --user setting permissions may need to be fixed manually.

IE: chown -R 999:999 ./{cert,data,logs}

A custom UID and GID can be configured for the container internal unifi user and group. For more information see the "Environment variables" section in this document.


ALWAYS MAKE A VERIFIED BACKUP OF DATA BEFORE INSTALLING UPDATES. Export a .unf from the web interface and/or stop the current container and create a backup or copy of the data volume. Database rollback from newer to older versions of UniFi and/or Mongo isn't always possible.


Usage

This container exposes three volumes:

  • /usr/lib/unifi/cert - SSL custom certificate storage
  • /usr/lib/unifi/data - UniFi configuration data and DBs
  • /usr/lib/unifi/logs - UniFi and MongoDB logs for troubleshooting

This container exposes the following ports (see: https://help.ubnt.com/hc/en-us/articles/218506997-UniFi-Ports-Used):

  • 3478/udp (port used for STUN connection)
  • 6789/tcp (port used for throughput measurement from Android/iOS app)
  • 8080/tcp (port for UAP/USW/USG to inform controller)
  • 8443/tcp (port for controller GUI / API)
  • 8880/tcp (port for HTTP portal redirect)
  • 8843/tcp (port for HTTPS portal redirect)
  • 10001/udp (port used for UBNT discovery broadcasts - Local LAN/L2/same subnet only)

The most basic way to run this container:

$ docker run --name unifi -d \
    -p 3478:3478/udp -p 8080:8080 -p 8443:8443 \
    -p 8880:8880 -p 8843:8843 \
    ghcr.io/goofball222/unifi

Recommended run method: Docker Compose - UniFi app and internal Mongo DB:


version: '3'

services:
  unifi:
    image: ghcr.io/goofball222/unifi
    container_name: unifi
    restart: unless-stopped
    network_mode: bridge
    ports:
      - 3478:3478/udp
      - 8080:8080
      - 8443:8443
      - 8880:8880
      - 8843:8843
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./cert:/usr/lib/unifi/cert
      - ./data:/usr/lib/unifi/data
      - ./logs:/usr/lib/unifi/logs
    environment:
      - TZ=UTC


Recommended run method: Docker Compose - UniFi app and Mongo DB as separate services:


version: '3'

services:
  mongo:
#   Use max mongo version 8.0.X. Higher versions are not recommended by Ubiquiti/UniFi.
#   Older versions are acceptable, ie: mongo:7.0
    image: mongo:8.0
    container_name: unifidb
    restart: unless-stopped
#   By default docker-compose will create a new bridge network for the services in the compose file.
#   Enable this to have the services/containers use the existing docker0/default bridge network.
#    network_mode: bridge
    volumes:
      - ./data/db:/data/db

  unifi:
    image: ghcr.io/goofball222/unifi
    container_name: unifi
    restart: unless-stopped
#   By default docker-compose will create a new bridge network for the services in the compose file.
#   Enable this to have the services/containers use the existing docker0/default bridge network.
#    network_mode: bridge
    links:
      - mongo
    ports:
      - 3478:3478/udp
      - 8080:8080
      - 8443:8443
      - 8880:8880
      - 8843:8843
#     Optional: Uncomment to enable speed tests from the UniFi iOS & Android apps
#      - 6789:6789
#     Optional: Uncomment for layer 2 broadcast discovery if container running on a host in the local LAN
#      - 10001:10001/udp
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./cert:/usr/lib/unifi/cert
      - ./data:/usr/lib/unifi/data
      - ./logs:/usr/lib/unifi/logs
    environment:
      - DB_MONGO_LOCAL=false
      - DB_MONGO_URI=mongodb://mongo:27017/unifi
      - STATDB_MONGO_URI=mongodb://mongo:27017/unifi_stat
      - TZ=UTC
      - UNIFI_DB_NAME=unifi


Alternative network setup suggested by rogierlommers -

Please make sure to read the "NETWORK: HOST" section of the Docker "run" reference and understand the implications of this before using.

Copy the following to both services in the docker-compose.yml file under the commented out network_mode: bridge line in the example above, and then uncomment the network_mode: host line:


#   Use host network mode. Does not allow for port remapping. You may need to manually adjust
#       host firewall settings to allow traffic. Running a container in this mode is considered insecure.
#    network_mode: host


Example basic docker-compose.yml in file form.

Example advanced docker-compose.yml in file form with external Mongo DB service and UniFi service using environment variables.


Environment variables:

VariableDefaultDescription
BIND_PRIVfalseSet to true to allow UniFi process to bind to container internal ports < 1024
DEBUGfalseSet to true for extra container and UniFi verbosity for debugging
JVM_EXTRA_OPTSunsetAny additional custom run flags for the container Java process
JVM_INIT_HEAP_SIZEunsetSets the start and min memory size for the container Java process (-Xms)
JVM_MAX_HEAP_SIZE1024MSets the max memory size for the container Java process (-Xmx)
LOGSTDOUTfalseSet to true to enable the (noisy!) UniFi process log output to STDOUT. System will still output to log volume files if configured.
PGID999Specifies the GID for the container internal unifi group (used for file ownership)
PUID999Specifies the UID for the container internal unifi user (used for process and file ownership)
READENVtrueSet to false to disable environment variables conversion to UniFi system.properties settings.
RUN_CHOWNtrueSet to false to disable the container automatic chown at startup. Speeds up startup process on overlay2 Docker hosts. NB/IMPORTANT: It's critical that you insure directory/data permissions on all mapped volumes are correct before disabling this or UniFi and/or Mongo will not start.
RUNAS_UID0falseSet to true to force the container to run the Java/Mongo processes as UID=0 (root) - workaround for setcap AUFS missing xargs failure - NB/IMPORTANT: running with this set to "true" is insecure

Recommended UniFi system.properties converted environment variables to externalize Mongo DB via docker-compose:

VariableRecommended SettingDescription
DB_MONGO_LOCALfalseSetting this to false tells UniFi that we're using an external Mongo DB
DB_MONGO_URImongodb://mongo:27017/unifiThis sets the URI that UniFi should connect to for the main configuration database
STATDB_MONGO_URImongodb://mongo:27017/unifi_statThis sets the URI that UniFi should connect to for the statistics database
UNIFI_DB_NAMEunifiSets a database name that can be connected and managed on the external Mongo DB server, must match with the URI variables (IE: unifi, unifi_stat = unifi).

NB/IMPORTANT: Although I've been running my own deployments with an external DB without issue with these settings externalizing the DB, just like running the app itself in a Docker container, is considered experimental and totally unsupported by UBNT. Full documentation for an external DB setup is outside the scope of this README and is left as an exercise for the interested reader. Additional information available on the UBNT forums in this post and in the PDF post linked below.

Additional UniFi system.properties config file settings can be passed to the container as -e/--env/environment flags at runtime (more detail and a PDF with UBNT examples here). Envrionment variables must be in ALL CAPS and replace "." with "_". -- IE:

system.propertiesEnvironment Variable
unifi.db.extraargsUNIFI_DB_EXTRAARGS
unifi.https.hstsUNIFI_HTTPS_HSTS

SSL custom certificate auto-configuration support (LetsEncrypt, etc.):

  1. Map the Docker host cert storage location or volume to the /usr/lib/unifi/cert volume exposed by the container
  2. Must contain a PEM format SSL private key corresponding to the SSL certificate to be installed. Private key file MUST be named privkey.pem.
  3. Must contain a PEM format SSL certificate file. Certificate file MUST be named cert.pem.
  4. Start the container. SSL import and Java keystore update process is automated during startup. Status, errors, etc. can be found in the container log, IE: docker logs "containername"
  5. Existing keystore file will be backed up to /usr/lib/unifi/data/keystore-"epochseconds"
  6. Java keystore is only updated when changes to the certificate files are detected. To force a re-import of existing files delete the unificert.sha256 file in ./cert and restart the container.

If you don't want to use a custom SSL certificate then the /usr/lib/unifi/cert volume can be left unmapped. Alternatively if the privkey.pem and/or fullchain.pem file are not present SSL customization will be skipped.

To revert from a custom cert to a UniFi self-signed certificate stop the container, rename or remove ./data/keystore, and restart the container. The UniFi application will automatically generate a new keystore file with a new self-signed cert.


beta and bleeding-edge official tag warning

NOT RECOMMENDED FOR USE IN A PRODUCTION ENVIRONMENT - FOR TESTING/LABS ONLY

There have been past UniFi beta and official releases with AP bricking firmware, network breaking bugs, etc.

Proceed with caution! Use at your own risk.

If you're going to use these images please make sure you create a UBNT community account: https://community.ui.com/

Instructions for how to sign up for beta/early access at: https://help.ui.com/hc/en-us/articles/204908664-How-To-Sign-Up-for-Early-Access

Please make sure to participate in discussion and create bug reports for any issues you encounter with beta/early access releases.

USE BETA/BLEEDING-EDGE RELEASES AT YOUR OWN RISK - REPEAT: NOT RECOMMENDED FOR USE IN A PRODUCTION ENVIRONMENT WITHOUT EXTENSIVE TESTING

Tag summary

Content type

Image

Digest

sha256:0e134e7a9

Size

271.7 MB

Last updated

5 days ago

docker pull goofball222/unifi:10.5-ubuntu-nomongo-beta