Sign inSign up

imdocked/unifi

By imdocked

•Updated about 9 years ago

Windows NanoServer Container image with Ubiquiti UniFi Controller v5.5.19

Image
1

239

imdocked/unifi repository overview

  • This is a Windows Container image with the Uniquiti Unifi Controller v5.5.19 software installed.
  • This image is created with a multi-stage dockerfile which is added to this description below
  • This image is based upon the microsoft/nanoserver image⁠

⁠Quickstart

  1. docker pull imdocked/unifi
  2. mkdir c:\Docker\UniFi\data
  3. docker run -d --hostname unifi -v c:\Docker\UniFi\data:c:\unifi\data imdocked/unifi
  4. ping unifi
  5. Start browser and navigate to https://unifi:8443/⁠

⁠Building the Image

The Image is build with a multi-stage dockerfile to keep footprint as small as possible.

The first stage is using the microsoft/windowsservercore⁠. In this stage the installation packages are downloaded and extracted.

The second/final stage copies the files from the first stage and configures the image for execution. This stage used the microsoft/nanoserver image⁠ as a base.

  • I have the dockerfile placed in the following directory c:\docker\unifi\dockerfile
  • I have my router on 192.168.11.1
  • I create a transparent network for the image
docker network create -d transparent --gateway=192.168.11.1 --subnet=192.168.11.0/24 \
-o com.docker.network.windowsshim.dnssuffix=docker.local \
-o com.docker.network.windowsshim.dnsservers=192.168.11.1 MyNet

docker build --network=MyNet -t imdocked/unifi "c:\docker\unifi"

# docker push imdocked/unifi

⁠How to run

  • I have given the image a static hostname "unifi", a static ip# "192.168.11.6" and a static mac-address "12:34:56:78:89:00".
  • I've created a static lease in my router for this hostname, mac-address and ip#.
  • I have the UniFI configuration files in "c:\docker\unifi\data" which i map as volume onto the folder with the UniFi controller configuration files.
mkdir c:\Docker\UniFi\data
docker run -d -v c:\Docker\UniFi\data:c:\unifi\data --network=MyNet --hostname unifi --mac-address 12:34:56:78:89:00 --ip 192.168.11.6   -p 8080:8080 -p 8443:8443 imdocked/unifi

⁠Dockerfile contents

FROM microsoft/windowsservercore as downloadbase
ADD http://www.7-zip.org/a/7z1700-x64.exe 7zip_installer.exe
ADD http://dl.ubnt.com/unifi/5.5.19/UniFi-installer.exe UniFi-installer.exe
ADD http://javadl.oracle.com/webapps/download/AutoDL?BundleId=220315_d54c1d3a095b4ff2b6607d096fa80163 jre.exe

# Use PowerShell as the default shell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

WORKDIR c:/

# Remark: 7zip outputdirectory folder issue resolved by adding @ character (last character gets removed)

RUN \
    start-process -wait -passthru -filepath 7zip_installer.exe -argumentlist "/S,/D=c:\\7zz" ; \
    Remove-Item C:\7zip_installer.exe; \
    
    New-Item -Type directory c:\files\\unifi  ; \
    start-process -passthru -wait -filepath C:\7z\7z.exe -argumentlist 'x -oc:\\files\\unifi c:\\UniFi-installer.exe' ; \
    Remove-Item -Recurse -Force c:\UniFi-installer.exe ; \
    Remove-Item -Recurse -Force c:\7z ;

RUN \
    start-process -filepath jre.exe -passthru -wait -argumentlist "/s,INSTALLDIR=c:\files\\java,/L,install64.log" ; \
    Remove-Item jre.exe ;

FROM microsoft/nanoserver  
COPY --from=downloadbase files/ /
EXPOSE 8080 8443
WORKDIR c:/unifi/bin/
ENTRYPOINT [ "start.bat" ]
LABEL   author="Sander Schutten" version="5.5.19" description="UniFi Controller v5.5.19 / jre v8.131"

# Use PowerShell as the default shell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

RUN Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value ($Env:path + ';c:\java\bin');

Tag summary

Content type

Image

Digest

Size

609.9 MB

Last updated

about 9 years ago

docker pull imdocked/unifi