Unifi Network Application Docker?

I understand the basic Container Station and have deployed a couple. However, the Unifi Network Application (Currently on 10.0.162) requires MongoDB as well as initializing the database for Unifi Network Application to use and the username and password. My current setup is a Raspberry PI4B and I have a full backup.

My setup is a TVS-H1688 and I am using the four 2.5GB/s interfaces as a LACP lag group trunked with two VLANs, VLAN 250 that I want to use for this into Virtual Switch 1. The other VLAN (Virtual Switch 5) is my IoT VLAN as I plan on eventually moving my Home Assistant off its Raspberry PI4B to it.

I am having a tough time figuring out where to put the YAML file to build the container and what I should use as far as figuring out where the storage should end up and where to assign that Virtual Switch 1 and then the static IP, subnet mask, default gateway and DNS servers.

I have to think someone has attempted this. Thank you in advance.

I have an easier solution for you. If you add MyQNAP.org to the App Center repository, there is a native Unifi application that will run on the QNAP directly. No need to run it in a Container.

Go into settings in App Center and add the MyQNAP.org repository link:

Then under “System Administration” you will find the UniFi Controller app.

It works great.

Hi @kahilzinger

I found a Docker image for UniFi on DockerHub.

I don’t know if this meets your needs, but I tried using this YAML file and it worked fine on my end.

You can take a look. & Replace the variables in the $ with your NAS settings.

version: "3.8"

services:
  unifi:
    image: jacobalberty/unifi:latest
    container_name: unifi-controller
    restart: unless-stopped

    networks:
      qnet-network:
        ipv4_address: ${QNET_STATIC_IP}

    environment:
      TZ: ${TZ}

    volumes:
      - ${SHARE_FOLDER}/unifi:/unifi

networks:
  qnet-network:
    driver_opts:
      iface: ${QNET_INTERFACE}
    driver: qnet
    ipam:
      driver: qnet
      options:
        iface: ${QNET_INTERFACE}
      config:
        - subnet: ${QNET_SUBNET}
          gateway: ${QNET_GATEWAY}

You could find the ${QNET_INTERFACE} from ssh and ifconfig command.

However, please note that this container / docker image is a third-party application, not our QNAP product, so you need to pay attention to data backup and stability.

====

version: "3.8"

services:
  unifi:
    image: jacobalberty/unifi:latest
    container_name: unifi-controller
    restart: unless-stopped

    networks:
      qnet-network:
        ipv4_address: 10.20.80.54

    environment:
      TZ: ${TZ}

    volumes:
      - /share/Container/unifi:/unifi

networks:
  qnet-network:
    driver_opts:
      iface: bond0
    driver: qnet
    ipam:
      driver: qnet
      options:
        iface: bond0
      config:
        - subnet: 10.20.80.0/23
          gateway: 10.20.80.254

I have tried this however, tcp/8080 was in use by the console (recently changed to a different port) and I do not know what port would be for the /inform web page and how I would change that to 8080 now that I am not using that port.

Is there a way to move this application to my other adapter team/virtual switch?

I would like to use this method if I could. It looks like the virtual switch I want to use is “qvs0” however; I see two things I would want to do:

1.) How do I determine the volume location?
2.) You have to install MongoDB and initialize it.

If I could find someone to help be do this I would gladly pay them because I want to learn and I am a big time noob when it comes to Docker but I could see me using this a lot more, especially in my Home Automation realm.

Here is the script that I found and have been trying to figure out:


version: “2.1”
services:
unifi-network-application:
image: lscr.io/linuxserver/unifi-network-application:latest
container_name: unifi-network-application
environment:

  • PUID=1000
  • PGID=1000
  • TZ=America/Chicago
  • MONGO_USER=unifi
  • MONGO_PASS=[[password]]
  • MONGO_HOST=unifi-db
  • MONGO_PORT=27017
  • MONGO_DBNAME=unifi
  • MEM_LIMIT=1024 #optional
  • MEM_STARTUP=1024 #optional

- MONGO_TLS= #optional

- MONGO_AUTHSOURCE= #optional

volumes:
  - /home/ubuntu/docker/unifi-controller:/config  <--Need to figure out where.
ports:
  - 8443:8443
  - 3478:3478/udp
  - 10001:10001/udp
  - 8080:8080
  - 1900:1900/udp #optional
  - 8843:8843 #optional
  - 8880:8880 #optional
  - 6789:6789 #optional
  - 5514:5514/udp #optional
labels:
  - "traefik.enable=true"
  - "traefik.http.routers.unifi.entrypoints=http"
  - "traefik.http.routers.unifi.rule=Host(`unifi.jimsgarage.co.uk`)"
  - "traefik.http.middlewares.unifi-https-redirect.redirectscheme.scheme=https"
  - "traefik.http.routers.unifi.middlewares=unifi-https-redirect"
  - "traefik.http.routers.unifi-secure.entrypoints=https"
  - "traefik.http.routers.unifi-secure.rule=Host(`unifi.jimsgarage.co.uk`)"
  - "traefik.http.routers.unifi-secure.tls=true"
  - "traefik.http.routers.unifi-secure.service=unifi"
  - "traefik.http.services.unifi.loadbalancer.server.port=8443"
  - "traefik.http.services.unifi.loadbalancer.server.scheme=https"
  - "traefik.docker.network=proxy"
networks:  <--Where would I assign the virtual switch and static IP information in here?
  proxy:
  unifi:
restart: unless-stopped

unifi-db:
image: docker.io/mongo:4.4
container_name: unifi-db
volumes:

  • /home/ubuntu/docker/unifi-controller-db:/data/db <–Need to figure out where.
  • /home/ubuntu/docker-compose/unifi-controller/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro <–Need to figure out where.
    networks: <–Would I need a static IP in here and virtual switch?
    unifi:
    restart: unless-stopped

networks:
proxy:
external: true
unifi:

! This below is the java script to initialize the MongoDB Database
!
! init-mongo.js
! db.getSiblingDB(“unifi”).createUser({user: “unifi”, pwd: “[[password]]”, roles: [{role: “dbOwner”, db: “unifi”}]});
! db.getSiblingDB(“unifi_stat”).createUser({user: “unifi”, pwd: “[[password]]”, roles: [{role: “dbOwner”, db: “unifi_stat”}]});