UniFi Network Server with Docker

UniFi Network Server with Docker

LinuxServer.io makes some great Docker images. I’ve been using their UniFi Controller image for a very long time. Sadly it is being deprecated in January 2024. Fortunately, they have a new replacement image named UniFi Network Application. There’s a bit more to the setup as the database portion has been decoupled from the image.

In this post, I’ll show you step-by-step how to set up the UniFi Network Application with Docker.

The UniFi Network Application uses MongoDB for its database we will need to set that up. MongoDB is composed of two elements, the main database and a stats database.

When you first make a MongoDB container it needs to be initialized there are a few methods to do this. I’ll be using the shell script method as I was able to make that word with all the environment variables I wanted to use.

Setup

Below is an example of what the .env file could look like.

CONTAINER_NAME=unifi-net
MONGO_DBNAME=unifi-mongodb
MONGO_USER=unifi-user
MONGO_PASS=hkjfhshgjsdfhjf
TIME_ZONE=America/EdmontonCode language: plaintext (plaintext)

How It Works

The .env file contains the variables that are used by the docker-compose.yml file and the init-mongo.sh file making it so you only have to define everything in one place which lowers the chance of typos and makes everything work easily.

There are two folders created, one of them is named core-data which is the config directory for the LinuxServer.io UniFi Network Application image. The other folder is named db-data this is where MongoDB stores the database files.

My docker compose file changes nothing with how the LinuxServer.io UniFi Network Application image works or how the MongoDB images works, I just added variables that work with the .env file. This means if you want to add other items that either image supports you can just add them to the docker compose file.

Extra UniFi Ports

In the docker compose file I only defined the minimum required ports that I needed. You can add more ports if you need them.

The ports I defined are

Here’s a list of all the ports that UniFi could use.

Exit mobile version