Skip to content

Instantly share code, notes, and snippets.

@thebiss
Created January 5, 2025 23:39
Show Gist options
  • Save thebiss/6942e63972a4a943a5ec3f91038e2de6 to your computer and use it in GitHub Desktop.
Save thebiss/6942e63972a4a943a5ec3f91038e2de6 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
# from: https://hub.docker.com/r/jacobalberty/unifi
set -euo pipefail
set -x
_sharedir="/var/mnt/vmshare"
mkdir -p "${_sharedir}/unifi/data"
mkdir -p "${_sharedir}/unifi/log"
chmod g+w "${_sharedir}/unifi"
chmod g+w "${_sharedir}/unifi/data"
chmod g+w "${_sharedir}/unifi/log"
# Customizations:
# - NY TZ
# - run as user unifi, bu
# - pin to version stable-6
#
# Follow EXACTLY the permissions tip from
# https://github.com/containers/podman/blob/main/troubleshooting.md#35-passed-in-devices-or-files-cant-be-accessed-in-rootless-container-uidgid-mapping-problem
#
# uid:gid for user UNIFI inside the container
_uid=999
_gid=999
podman run -d --init \
--restart=unless-stopped \
-p 8080:8080 \
-p 8443:8443 \
-p 3478:3478/udp \
-e TZ='America/New_York' \
-v "${_sharedir}/unifi:/unifi:Z" \
--user "${_uid}:${_gid}" \
--name unifi \
--userns=keep-id:uid=$_uid,gid=$_gid \
docker.io/jacobalberty/unifi:stable-6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment