- pjortiz/docker-unifi-mongo
- linuxserver/unifi-network-application Official Image
- Mongo Official Image
(Rant, please feel free to skip ahead..)
While I myself am a person in the tech industry and deal with similar systems and tools on my day to day, I found the Linuxserver instructions in their README vary vague and required a high bar to entry in comparison to the simple plug and play effort that was required for the now deprecated Unifi Controller. I understand there were some issues maintaining the single image with the Unifi software and MongoDB, but by not specifying a recommended or suggested Mongo version, this now requires the end user to understand the nuances across the many compatible version. The biggest being, the changes between Mongo versions 5 to 6, on how the mongo
command was change to mongosh
. In addition, while should not be terribly difficult access the Docker host filesystem, having to prepare the init script and attach it as a volume just adds another thing for the end user to manage and think about. All of these nuances can compound into multifaceted issues that the user now need to debug. I understand it is not reasonable to expect Linuxserver, or any other developer, to cater to every possible end user's use-case, we could at least expect a base example that covers 80-90% of them. Anyway, this compose file aims to do just that while still attempting to support all the Mongo versions1.
- A system with Docker and Docker Compose installed and working.
- A basic understanding on how to deploy docker-compose.yml files.
Copy the below command into any CLI. 2
Make sure to change MONGO_PASS
and set MONGO_VERSION
as needed.
printf "MONGO_VERSION=6.0.15\nMONGO_PASS=changeme" > .env && curl -Lf -o docker-compose.yml https://raw.githubusercontent.com/pjortiz/docker-compose-unifi-network-application/main/docker-compose.yml && docker compose -p unifi-network-application --env-file .env up --detach
Note: this docker-compose.yml
uses Mongo version 6.0.15
by default, so specifying MONGO_VERSION
above with the same is technically redundant.
Clean up left over files if needed with below command.
rm -f .env docker-compose.yml
Create a new project directory and name it unifi-network-application
. Here you will place the .env
and docker-compose.yml
files as detailed in the next steps.
Download the .env.template
file and rename it to .env
or create an empty file.
Add/Change the following:
MONGO_VERSION=6.0.15 # Optional, if not provided uses default
MONGO_PASS=changeme # Required
Change the MONGO_PASS
to what every you want. And set the MONGO_VERSION
to meet your needs or leave default.
Either download through your browser or using the command below:
curl -Lf -o docker-compose.yml https://raw.githubusercontent.com/pjortiz/docker-compose-unifi-network-application/main/docker-compose.yml
Open a CLI and make sure your working directory is in the same and the .env
and docker-compose.yml
, then run the this command:
docker compose -p unifi-network-application --env-file .env up --detach
Open your web browser and navigate to https://localhost:8443
or the IP/Domain of your host system.
To remove run the following command:
docker compose -p unifi-network-application rm --stop
Add option --volumes
after rm
to remove volumes as well.