Skip to content

pjortiz/docker-unifi-mongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

140 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-unifi-mongo

Table of Contents


Latest Major Version Build CI

4.x 5.x 6.x 7.x 8.x
tag -  4.4.30-focal tag -  5.0.32-focal tag -  6.0.27-jammy tag -  7.0.31-jammy tag -  8.0.20-noble
tag -  8.2.7-noble

Quick reference


About

This image is packaged with the required mongo init script to set up linuxserver/unifi-network-application.


Usage

Docker Compose

version: "3.7"
networks:
  # proxy-network: # optional, Use this network or your own if you intend to configure the unifi-network-application container through a revers proxy, otherwise not needed.
    # external: true
  unifi:
volumes: # You can change the volumes' device path if you want, otherwise no need to change, default Docker volume folder location will be used 
  unifi_mongo_data:
services:
  unifi-mongo-db:
    image: portiz93/unifi-mongo:${MONGO_VERSION:-}    # Required MONGO_VERSION, Default "", specify whatever Mongo version tag you need. DO NOT set 'latest' tag
    container_name: unifi-mongo-db
    environment:
      # - MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME:-root}                    # Required only if using mongodb version < 6.0, otherwise do not set (See official Mongo image)
      # - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD:?Root Password Required}  # Required only if using mongodb version < 6.0, otherwise do not set  (See official Mongo image)
      - MONGO_USER=${MONGO_USER:-unifi}                     # Default "unifi"
      - MONGO_PASS=${MONGO_PASS:?Mongo Password Required}   # Required
      - MONGO_DBNAME=${MONGO_DBNAME:-unifi}                 # Default "unifi"
    volumes:
      - unifi_mongo_data:/data/db
    # ports:
    #   - 27017:27017                                       # optional, Default "27017", only port if needed outside of unifi app
    networks:
      unifi:
    restart: unless-stopped

Docker CLI

Create the network

docker network create unifi

Create the volume

docker volume create unifi_mongo_data

Run the MongoDB container

docker run -d \
  --name unifi-mongo-db \
  --network unifi \
  -v unifi_mongo_data:/data/db \
  -e MONGO_USER=unifi \
  -e MONGO_PASS=your_mongo_password_here \
  -e MONGO_DBNAME=unifi \
  --restart unless-stopped \
  portiz93/unifi-mongo:

Build Your Own Image

docker build -t unifi-mongo: --build-arg MONGO_VERSION= . 

Adding your own scripts

If you need a custom script based on your needs. After forking/clone this repo create a directory under scripts with your specific Mongo version tag (e.g. scripts/), then add your script(s) in that new directory. Then run the above build command with your specific version.

Disclaimer

I have not validated any of the images as to whether they are working as expected apart from the image(s) I use myself. Please create an issue and I will see if I can address/accommodate your needs.