Skip to content

EN Docker

Guiyomee edited this page Nov 27, 2026 · 5 revisions

Docker

Français · Installation

Multi-stage image: web interface (Node 24), program (Rust, with the built-in object recognition), then a minimal Debian 13 with FFmpeg. The program runs under an unprivileged account (uid 1000).

Two ways to get it:

  • published image ghcr.io/guiyomee/rustnvr (Linux x86-64 and, since 2026.11.11, ARM 64-bit: Docker takes the one of the machine), built by GitHub on each update of the repository: nothing to build;
  • built on your machine from the code (build: .), for instance for a modified version.

1. Published image (the simplest)

mkdir rustnvr && cd rustnvr
curl -fsSLO https://raw.githubusercontent.com/Guiyomee/RustNVR/main/compose.yaml
echo 'RUSTNVR_WEB_PASSWORD=a-strong-password' > .env
chmod 600 .env
docker compose up -d
docker compose logs -f

Tags: latest (latest version of the repository), 2026.11.11 (a released version, which no longer changes), sha-… (a given commit).

Portainer: Stacks → Add stack → « Web editor », paste compose.yaml and add the variable RUSTNVR_WEB_PASSWORD.

Interface: https://<docker-machine>:8080/, account admin and the password from .env.

2. Building from the code

Get the repository. Do not copy config.toml nor the *.ui.toml files of an installation: they hold the passwords of the cameras, MQTT and storage (.gitignore and .dockerignore leave them out). In compose.yaml, replace the image: ghcr.io/… line with build: ., then:

echo 'RUSTNVR_WEB_PASSWORD=a-strong-password' > .env
chmod 600 .env
docker compose up -d --build

The first build compiles the whole project (several minutes, a few GB of disk space); the next ones reuse the cache.

3. HTTPS

The Docker configuration turns on a self-signed certificate, made at the first start for the machine's address. The browser warns once: compare the fingerprint it shows with the one in the log (« HTTPS enabled … sha256= »), then accept. An http://…:8080 address is redirected to https://. Other names (VPN address, DNS name): tls_names in /config/config.toml. A real certificate: a reverse proxy (see Accounts and security) or tls_cert / tls_key.

Older installation without HTTPS (/config/config.toml is only created at the first start): add the line once.

docker exec rustnvr sh -c "grep -q '^tls_self_signed' /config/config.toml || sed -i 's/^\[web\]$/[web]\ntls_self_signed = true/' /config/config.toml"
docker restart rustnvr

4. Network

compose.yaml uses the host network (network_mode: host): RustNVR reaches the cameras as the host does, ONVIF discovery (multicast) and the « Low latency » live view (WebRTC, UDP) work. On a « bridge » network (remove network_mode, uncomment ports), the standard live view works, WebRTC and automatic ONVIF discovery do not.

Another port. On the host network, ports has no effect: RustNVR listens on listen in /config/config.toml (8080). For another port, without touching that file, add to environment:

      RUSTNVR_WEB_LISTEN: "0.0.0.0:8082"

Handy to run two RustNVR on the same machine. The health check follows the same port.

RTSP republication (Settings → Network): port 8554 over TCP. On the host network, nothing to add; on « bridge », add "8554:8554" to ports.

A camera often accepts only a few RTSP connections: if a camera stays « offline » (error 500 at SETUP), stop the other software reading it, or use the RTSP republication.

5. Settings of your own machine

Do not edit compose.yaml: put your lines in compose.override.yaml, which docker compose up -d merges by itself (example: compose.homelab.example.yaml). With Portainer (stack from a Git repository), keep compose.yaml as the main file and add yours under « Additional paths ».

Disk or NAS mounted on the host: add it to volumes, give the folder to account 1000, then declare /nas in Settings → Storage (« Network share must be mounted »):

services:
  rustnvr:
    volumes:
      - /mnt/nas/rustnvr:/nas
sudo chown -R 1000:1000 /mnt/nas/rustnvr

USB webcam: the device, with the host's video group (getent group video, often 44). A /dev/v4l/by-id/… path does not change when the webcam is plugged elsewhere, but then /dev/v4l:/dev/v4l:ro must be mounted too.

services:
  rustnvr:
    devices:
      - /dev/video0:/dev/video0
    group_add:
      - "44"

Graphics card, for the H.264 conversions (live view, playback and exports for browsers without H.265) and so that it shows in Settings → Artificial intelligence → Graphics cards:

  • Intel, AMD (VAAPI): the device and the group owning it on the host (stat -c '%g %G' /dev/dri/renderD128). The image holds the drivers (Intel iHD and i965, AMD); on an Intel processor up to the 9th generation, i965 encodes H.264.

    services:
      rustnvr:
        devices:
          - /dev/dri:/dev/dri
        group_add:
          - "992"
  • NVIDIA (NVENC), with nvidia-container-toolkit on the host:

    services:
      rustnvr:
        gpus: all
        environment:
          NVIDIA_DRIVER_CAPABILITIES: compute,video,utility

In a VM, the card must first be given to the VM (passthrough). Setting: Settings → Network → « Convert on the graphics card when possible » (on by default). At startup, tests pick what works; without a card, or if the tests fail, the processor converts.

6. Data

Volume Content
rustnvr-config → /config config.toml (made at the first start) and the settings made in the interface (*.ui.toml, camera passwords included)
rustnvr-data → /data recordings (/data/recordings), database, thumbnails, H.264 copies, exports (/data/rustnvr)

Reading and replacing config.toml:

docker compose exec rustnvr sh -c 'cat /config/config.toml'
docker compose cp ./config.toml rustnvr:/config/config.toml
docker compose restart

7. Object recognition

Settings → Artificial intelligence → « Built-in » → Download, then « Save »: the model is fetched by the container (Internet access needed), checked and kept in /data/rustnvr/models/. Without Internet access, copy it, then give /config/yolox_nano.onnx as the model file:

docker compose cp yolox_nano.onnx rustnvr:/config/yolox_nano.onnx

CodeProject.AI can run in its own container (image codeproject/ai-server, port 32168): Settings → Artificial intelligence → « CodeProject.AI / DeepStack », button « Test the address ». On an Intel iGPU it computes on the processor (≈ 1 s per picture), slower than the built-in recognition: it is only worth it with an NVIDIA card (cuda image). See Detection and AI.

8. Update, stop, health

docker compose pull && docker compose up -d   # published image
docker compose up -d --build                  # built: after git pull
docker compose down                           # stops (the volumes are kept)

docker stop sends SIGTERM: RustNVR finishes its segments and stops cleanly.

The image has a health check: every 30 s, rustnvr health asks the server. Portainer and docker ps show « healthy », or « unhealthy » after 3 failures (port already taken, invalid configuration, server stuck). Docker does not restart an « unhealthy » container by itself; restart: unless-stopped restarts it if it stops.

Clone this wiki locally