Jacek Kowalski
2020-05-18 71f45aa4f01f7d3c4c79af9f0fa118645b8931af
commit | author | age
bab5d7 1 # UniFi
JK 2
b16cbd 3 This is a Docker image of UniFi SDN controller
bab5d7 4 based on `openjdk:8-jre-slim`
JK 5
6 ## Tags
7
8 Container is created for each stable UniFi release and tagged as vX.X.X.
c6c0d4 9 `:latest` tag is for the latest stable release (currently 5.11).
b16cbd 10 `:lts` tag is for the latest 5.6 LTS release.
bab5d7 11
JK 12 ## Usage
13
14 ```bash
15 docker run -d --name=unifi \
16     -p 8080:8080 -p 8443:8443 \
17     jacekkow/unifi
18 ```
19
20 UniFi interface should be available at https://127.0.0.1:8443/
21 (first run wizard is opened if the instance is unconfigured).
22
23 By default it uses Docker data volume for persistence.
24
25 You can update such installation by passing `--volumes-from` option
26 to `docker run`:
27
28 ```bash
29 docker pull jacekkow/unifi
30 docker stop unifi
31 docker rename unifi unifi-old
32 docker run -d --name=unifi \
33     -p 8080:8080 -p 8443:8443 \
34     --volumes-from unifi-old \
35     jacekkow/unifi
36 docker rm -v unifi-old
37 ```
38
39 ### Local storage
40
41 If you prefer to have direct access to container's data
42 from the host, you can use local storage instead of data volumes:
43
44 ```bash
45 docker run -d --name=unifi \
46     -p 8080:8080 -p 8443:8443 \
47     -v /srv/unifi/data:/usr/lib/unifi/data \
48     --user root \
49     jacekkow/unifi
50 ```
51
52 `/srv/unifi/data` directory will be automatically populated
53 with default configuration if necessary.
54
55 File ownership is recursively changed to `unifi:unifi` (`500:500`)
56 on each start, provided the container is run as root
57 (don't worry - unifi user will be used to start UniFi).
58
59 ### Captive portal and STUN
60
61 Using captive portal requires forwarding of additional ports
62 (8880 and 8843):
63
64 ```bash
65 docker run -d --name=unifi \
66     -p 8080:8080 -p 8443:8443 \
67     -p 8880:8880 -p 8843:8843 \
68     jacekkow/unifi
69 ```
70
71 For STUN (NAT traversal) UDP port 3478 must be available:
72
73 ```bash
74 docker run -d --name=unifi \
75     -p 8080:8080 -p 8443:8443 \
76     -p 3478:3478/udp \
77     jacekkow/unifi
78 ```
79
80 Note that STUN was not tested in container-based environment!
81 This port is also not exposed in Dockerfile.
82
83 ### Configuration
84
85 You can configure the instance by editing files 
86 in directory /usr/lib/unifi/data inside the container
87 (or appropriate host dir if local storage is used).
88
89 By default the JVM is started with option `-Xmx1024m`.
90 You can override this default using `JAVA_OPTS` environment
91 variable:
92
93 ```bash
94 docker run -d --name=unifi \
95     -p 8080:8080 -p 8443:8443 \
96     -e "JAVA_OPTS=-Xmx512m" \
97     jacekkow/unifi
98 ```