Channels DVR Server in docker setup

I want to spin up a test dvr server in a container. The host machine already has channels running on it. Linux Ubuntu desktop with docker and portainer installed. I have other containers running and all is well but they don’t have large storage requirements like a dvr.

My question stems on storage and docker compose layout. I have multiple drives attached and I would like the dvr software to run on the host os drive but I want the recordings stored at a different drive. lets say the path to that drive is
/mnt/blaablaablaa/piggy

What do I need to change create or whatever to accomplish this. Or don’t change anything and I’ll just be able to choose that location in the dvr setup. Here is the compose I’m starting with.

channels-dvr:
  image: fancybits/channels-dvr:tve
  container_name: channels-dvr
  network_mode: host
  ports:
    - "8088:8089"
  restart: on-failure:10
  devices:
    - /dev/dri:/dev/dri
  volumes:
    - /mnt/disk/dvr/config:/channels-dvr
    - /mnt/disk/dvr/recordings:/shares/DVR

The first line under volumes defines where the data related to the channels dvr executable is stored. With the value to the right of the colon being the location inside the container (don't change this), and the value to left being a binding to a directory on the host computer to make this data persistent through reboots and the like.

The second line under volumes defines where the dvr recordings will be stored, and the value to the right of the colon can pretty much be anything you want (but whatever you choose is the path you need to use when you're setting up Channels). In other words, as far as Channels is concerned this is the path to your recordings.

However, this is also a directory binding, so the value to the left of the colon is the actual location on the host computer where your recordings will be stored. For convenience, some will use the same path inside the container as they're using on the host to minimize confusion.

Here's the Docker Compose I'd recommend as a starting point:

version: '3.9'
services:
  # 2024.09.15
  # Docker Hub home for this project: https://hub.docker.com/r/fancybits/channels-dvr
  channels-dvr:
    image: fancybits/channels-dvr:${TAG}
    container_name: channels-dvr
    #devices:
      #- /dev/dri:/dev/dri
    ports:
      - ${HOST_PORT}:${CHANNELS_PORT}
    environment:
      - CHANNELS_PORT=${CHANNELS_PORT}
      - TZ=${TZ}
    volumes:
      - ${HOST_DIR}/channels-dvr:/channels-dvr
      - ${DVR_SHARE}:${DVR_CONTAINER_DIR}
    #network_mode: host
    restart: unless-stopped
#volumes: # use this section if you've setup a docker volume named channels-dvr, with CIFS or NFS, to bind to /channels-dvr inside the container
  #channels-dvr:
    #external: ${VOL_EXTERNAL}
    #name: ${VOL_NAME}

With these sample env vars:

TAG=tve
HOST_PORT=8089
CHANNELS_PORT=8089
TZ=America/Denver
HOST_DIR=/data
DVR_SHARE=/mnt/dvr
DVR_CONTAINER_DIR=/shares/DVR
1 Like

Thanks so much for the explanation. So if I’m understanding correctly all I really need to change is the bottom volume like so with these variables

TAG=tve
HOST_PORT=8088 (8089 in use on host)
CHANNELS_PORT=8089
TZ=America/Denver
HOST_DIR=/data
DVR_SHARE=/mnt/blaablaablaa/piggy
DVR_CONTAINER_DIR=/shares/DVR

And when running the actual dvr setup my storage path drill down will be /shares/DVR.
Correct?

That should work!

1 Like

A couple notes
If you want to enable hardware transcoding, uncomment these two lines

    #devices:
      #- /dev/dri:/dev/dri

If you need to run the container in host network mode, uncomment this line

    #network_mode: host

and change the env var CHANNELS_PORT=8089 to CHANNELS_PORT=8088

1 Like

Great points. I’m up and running. Thank you both for the help.