[Unit] Description=Unifi server Requires=docker.service After=docker.service DefaultDependencies=no [Service] Type=simple Environment="HOME=/root" ExecStartPre=-/usr/bin/env sh -c '/usr/bin/env docker kill unifi 2>/dev/null' ExecStartPre=-/usr/bin/env sh -c '/usr/bin/env docker rm unifi 2>/dev/null' ExecStart=/usr/bin/env docker run --rm --name unifi --log-driver=none -p 3478:3478/udp -p 8080:8080 -p 8443:8443 -p 6789:6789 -p 8843:8843 -p 8880:8880 -v unifi:/var/lib/unifi -v unifilog:/unifi -v unifirun:/var/run/unifi {{ unifi_version }} ExecStop=-/usr/bin/env sh -c '/usr/bin/env docker kill unifi 2>/dev/null' ExecStop=-/usr/bin/env sh -c '/usr/bin/env docker rm unifi 2>/dev/null' Restart=always RestartSec=30 SyslogIdentifier=unifi [Install] WantedBy=multi-user.target