Last active
January 6, 2017 11:56
-
-
Save bcremer/25a08e50225e27c6f93748eb681b61a5 to your computer and use it in GitHub Desktop.
Unifi Controller in Docker started by Systemd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Unifi Docker Container | |
After=docker.service | |
Requires=docker.service | |
[Service] | |
User=bcremer | |
TimeoutStartSec=0 | |
Restart=always | |
ExecStartPre=-/usr/bin/docker stop %n | |
ExecStartPre=-/usr/bin/docker rm %n | |
ExecStart=/usr/bin/docker run --cap-drop=ALL --rm --name %n --net=host --volume=unifi-controller-data:/var/lib/unifi bcremer/unifi-controller | |
ExecStop=-/usr/bin/docker stop %n | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:jessie | |
MAINTAINER Jacob Alberty <jacob.alberty@foundigital.com> | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN echo "deb http://www.ubnt.com/downloads/unifi/debian unifi5 ubiquiti" > \ | |
/etc/apt/sources.list.d/20ubiquiti.list && \ | |
echo "deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen" > \ | |
/etc/apt/sources.list.d/21mongodb.list && \ | |
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" > \ | |
/etc/apt/sources.list.d/webupd8team-java.list && \ | |
apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50 && \ | |
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 && \ | |
apt-key adv --keyserver keyserver.ubuntu.com --recv EEA14886 && \ | |
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections | |
RUN apt-get -q update && \ | |
apt-get install -qy --force-yes --no-install-recommends oracle-java8-installer oracle-java8-set-default unifi && \ | |
apt-get -q clean && \ | |
rm -rf /var/lib/apt/lists/* && \ | |
rm -rf /var/cache/oracle-jdk8-installer && \ | |
mkdir -p /var/lib/unifi /var/log/unifi /var/run/unifi && \ | |
chown -R nobody:nogroup /usr/lib/unifi /var/lib/unifi /var/log/unifi /var/run/unifi && \ | |
ln -s /var/lib/unifi /usr/lib/unifi/data | |
USER nobody | |
EXPOSE 6789/tcp 8080/tcp 8081/tcp 8443/tcp 8843/tcp 8880/tcp 3478/udp | |
VOLUME ["/var/lib/unifi"] | |
WORKDIR /var/lib/unifi | |
ENTRYPOINT ["/usr/bin/java", "-Xmx1024M", "-jar", "/usr/lib/unifi/lib/ace.jar"] | |
CMD ["start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker build -t bcremer/unifi-controller:latest . | |
docker volume create --name unifi-controller-data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment