Docs · v0.5.3

Docker

This page covers running Trunk Recorder Pro in a Docker container on a Linux host: the image, the docker-compose.yml that comes with it, USB passthrough, and what the container can and can't do.

Before you start

  • A Linux host, x86-64 or ARM64 (a Raspberry Pi with a 64-bit OS works). The image is built for linux/amd64 and linux/arm64.
  • Not Docker Desktop on macOS or Windows. Containers there run inside a virtual machine that can't see your USB devices, so the recorder would find no dongles. Use the macOS or Windows app instead.
  • RTL-SDRs, HackRF Ones, Airspy R2 / Mini and HydraSDR RFOnes only. The image contains trunk-pro (with its own drivers for these) and a small ffmpeg, nothing else: no UHD, libbladeRF or SoapySDR, so USRP, bladeRF and SoapySDR sources (and older RTL-SDRs that need SoapySDR) don't work in it. Use the Linux package for those, or ask for one in an issue.
  • Nothing else may hold the dongles. Stop any SDR program on the host that has them open. The kernel's DVB TV driver is not a problem: Trunk Recorder Pro detaches it itself.

The image

The image is on Docker Hub as robotastic/trunk-recorder-pro:

Tag What it is
latest The newest release
1.2.3, 1.2 A specific release, or the newest of a minor version (a pre-release such as 1.2.3-rc.1 gets only its own tag)
edge Built from every change to the main branch: newest, least tested

By default the container runs trunk-pro serve --no-open --bind 0.0.0.0: the recorder with its interface listening on port 8080 on every address inside the container.

Run it with Docker Compose

Get docker-compose.yml from the repository, put it in a folder of its own (say ~/trunk-pro), and from that folder:

docker compose up -d

Then open http://<host>:8080 and set it up there, starting at Getting started. The interface is the same as on the desktop.

The compose file:

services:
  trunk-pro:
    image: robotastic/trunk-recorder-pro:latest
    build: .
    container_name: trunk-pro
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      - ./data:/data
      - /dev/bus/usb:/dev/bus/usb
      - /etc/localtime:/etc/localtime:ro
    device_cgroup_rules:
      - "c 189:* rmw"

What each part does:

Setting Why
image The Docker Hub image. build: . lets docker compose up -d --build build it from a checkout of the repository instead.
restart: unless-stopped Starts it again after a crash or a reboot of the host, unless you stopped it yourself.
ports: "8080:8080" The interface, on port 8080 of every address of the host.
./data:/data Everything the recorder keeps: settings, the store, plugins and recordings, in ./data next to the compose file.
/dev/bus/usb:/dev/bus/usb The host's USB devices, including ones plugged in after the container starts.
device_cgroup_rules: "c 189:* rmw" Permission to open USB devices (character devices with major number 189). Together with the line above, this lets the container use any dongle without privileged: true.
/etc/localtime The host's time zone, so call times and file names are local time.

Start recording on its own

The container starts the recorder, but recording waits for Start until you either turn on Record when the app starts in Setup → Recording (recommended: set it once and every restart resumes recording), or uncomment the command: line in the compose file:

    command: ["serve", "--no-open", "--bind", "0.0.0.0", "--start"]

Where the files are

Inside the container everything is under /data, which the compose file maps to ./data on the host:

What Host Container
Settings (config.json), the store (trunk-pro.sqlite), plugins ./data/config/trunk-pro/ /data/config/trunk-pro/
Recordings ./data/TrunkRecorderPro/ /data/TrunkRecorderPro/

The container runs as root, so the files in ./data belong to root on the host. Use sudo to edit or remove them.

If you change the Recordings folder in the settings, keep it under /data (for example /data/recordings), or mount another host folder into the container and point it there. Give the full path: a relative one such as recordings won't start. Anything written elsewhere in the container is lost when the container is replaced.

Security

Signing in is off until you turn it on: until then, anyone who can reach port 8080 can change the settings, install plugins and stop the recorder. Turn it on in Setup → Access, or from the host:

docker compose exec trunk-pro trunk-pro access add me   # an Admin user; prints their token's secret once
docker compose exec trunk-pro trunk-pro access on
docker compose restart

To keep the interface to the host itself, publish it on localhost only ("127.0.0.1:8080:8080" under ports:) and reach it through an SSH tunnel or a cloudflared service beside it. To use another port on the host, change only the left-hand number: "8081:8080". Signing in, tunnels and proxies are in Remote access and signing in.

HTTPS

To serve HTTPS (HTTPS), mount the certificate and key into the container read-only, and point server.tls in config.json at them as the container sees them:

    volumes:
      - ./data:/data
      - /etc/letsencrypt:/etc/letsencrypt:ro    # or the folder tailscale cert or mkcert wrote to
"server": { "tls": { "cert": "/etc/letsencrypt/live/radio.example.com/fullchain.pem", "key": "/etc/letsencrypt/live/radio.example.com/privkey.pem" } }

Mount the folder, not the two files: Let's Encrypt's live/ files are links into archive/, and a renewal replaces them; with the folder mounted, the recorder picks the new pair up within a minute without a restart. Then docker compose restart and open https://<host>:8080.

Everyday commands

docker compose logs -f              # follow the log
docker compose restart              # restart the recorder
docker compose pull && docker compose up -d     # update to the newest image
docker compose down                 # stop and remove the container (./data is kept)
docker compose exec trunk-pro trunk-pro devices # list the dongles the container sees

When the container stops, Docker sends it SIGTERM and Trunk Recorder Pro saves the calls in progress before it exits.

Without Compose

The same thing with docker run:

docker run -d --name trunk-pro --restart unless-stopped \
  -p 8080:8080 \
  -v "$PWD/data:/data" \
  -v /dev/bus/usb:/dev/bus/usb \
  -v /etc/localtime:/etc/localtime:ro \
  --device-cgroup-rule 'c 189:* rmw' \
  robotastic/trunk-recorder-pro:latest

Building the image yourself

From a checkout of the repository:

docker build -t trunk-pro .
docker buildx build --platform linux/amd64,linux/arm64 -t trunk-pro .    # both architectures

or docker compose up -d --build.

Problems

  • No dongles in Setup. Check the host sees them (lsusb), that no program on the host has them open, and that the compose file's /dev/bus/usb volume and device_cgroup_rules are in place. docker compose exec trunk-pro trunk-pro devices shows what the container sees.
  • The page doesn't load from another machine. Check the ports: line (a 127.0.0.1: prefix limits it to the host) and the host's firewall.
  • Call times are in UTC. The /etc/localtime volume is missing.

The Platform page in the interface knows it's in a container: its CPU and memory figures are the container's limits, and its disks are the mounted volumes.

This page on GitHub · written for v0.5.3