Channels DVR on docker

FWIW, here's what I do on my DS1618+. I have a MACVLAN so all my containers can have their own IP address with ports for the router firewall using something like this: https://blog.oddbit.com/post/2018-03-12-using-docker-macvlan-networks/

(If you end up going this route I can give you my specific details if needed.)

docker pull fancybits/channels-dvr:tve

docker run --detach --network docker-net --ip=10.0.1.125 --mac-address 02:42:0a:00:02:7d --name=channels-dvr -e TZ=America/New_York --volume /volume1/channels/config:/channels-dvr --volume /volume1/channels/recordings:/shares/DVR --volume /volume1/channels/mylibrary:/mylibrary fancybits/channels-dvr:tve

It's been running like this for over a year without any issues. Support provided the egress domains for channels if you need for firewall.

Thanks.

I already created a user defined bridge network 'cdvr-net' that works fine for my purposes. I won't be using remote access.

My current docker run command is

docker run \
  --detach \
  --name=channels-dvr-tve \
  --env TZ=America/Los_Angeles \
  --network=cdvr-net \
  -p 192.168.1.3:8189:8089/tcp \
  --restart=on-failure:10 \
  --volume "/volume1/arkives/ChDockerDVR/config:/channels-dvr" \
  --volume "/volume1/arkives/ChDockerDVR/recordings:/shares/DVR" \
  --volume "/volume1/arkives/testMovies:/shares/import/movie:ro" \
  --volume "/volume1/arkives/testTV Shows:/shares/import/tv:ro" \
  fancybits/channels-dvr:tve

Well that was a long walk down an unfamiliar path to get here.

Something's not right with the docker container and permissions.
Directories and files are being created like a UMASK 777 was in place.
Do I need to pass a UID or UMASK somehow to the container run command?

The containers run.sh fails to find the excectuable file channel-dvr because of its perms.

#!/bin/sh
set -e
if [ ! -x /channels-dvr/latest/channels-dvr ]; then
  echo Installing Channels DVR..
  curl -f -s https://getchannels.com/dvr/setup.sh | DOWNLOAD_ONLY=1 sh
fi
cd /channels-dvr/data
echo Running Channels DVR..
exec ../latest/channels-dvr >> channels-dvr.log 2>&1
ls -l latest/channels-dvr
----------+ 1 root root 38749040 Jan 19 20:46 latest/channels-dvr

Once I chmod 755 latest/channels-dvr, it works fine.

@tmm1 it appears the setup.sh script run during install does set the execute bit on all files downloaded (latest release) during the initial install using 'chmod +x channels-dvr/$version/*'

release version 2021.01.15.1649
---x--x--x 1 root root 38736176 Jan 19 20:36 channels-dvr
---x--x--x 1 root root 22602264 Jan 19 20:36 comskip
---x--x--x 1 root root 79617272 Jan 19 20:36 ffmpeg
---x--x--x 1 root root 13673672 Jan 19 20:36 ffmpeg-dl
---x--x--x 1 root root 15375416 Jan 19 20:36 ffprobe
---x--x--x 1 root root 376 Jan 19 20:35 linux-x86_64.sha256

But, whatever is doing the pre-release update is not setting the execute bit on the pre-release version files that are downloaded.

pre-release version 2021.01.19.1937
----------+ 1 root root 38749040 Jan 19 20:46 channels-dvr
----------+ 1 root root 22602264 Jan 19 20:46 comskip
----------+ 1 root root 79617272 Jan 19 20:46 ffmpeg
----------+ 1 root root 13673672 Jan 19 20:46 ffmpeg-dl
----------+ 1 root root 15375416 Jan 19 20:46 ffprobe
----------+ 1 root root 376 Jan 19 20:46 linux-x86_64.sha256
----------+ 1 root root 15 Jan 19 20:46 prerelease
----------+ 1 root root 15 Jan 19 20:46 version

Hence, when the container is stopped and started running pre-release 2021.01.19.1937, the run.sh script fails to find /channels-dvr/latest/channels-dvr as an executable and redownloads the latest release 2021.01.15.1649 and runs it.

I did check the umask in the container and it's 0022. Any file I create within the container 'touch test.txt' has perms as expected, 644 for normal files. If I create a file in one of the volume mounts from within the container 'touch channels-dvr/test.txt' it's created with perms 000.

So, at this point, anytime I update to a new pre-release, I have to 'chmod +x channels-dvr/latest/*' (actually 'chmod +x channels-dvr/latest/channels-dvr' would work)..

1 Like

I'm about to remove docker from my system.

The only reason I installed it was to learn Docker (and running channels-dvr in Docker gave me the motivation).

If it doesn't work with channels-dvr, I'm done wasting my time learning Docker (and linux to understand Docker).

I understand the file system mounts and userspace swapping, but if I cannot maintain channels-dvr on it without jumping through hoops (chmod +x channels-dvr/latest/channels-dvr) everytime I update versions, then no point in using it.

Spent way too much time learning things about Docker and linux I shouldn't have to know (and will soon forget) to get to this point. Just another layer of complexity to deal with.

I know there are other ways to run a container, but I'm a Synology NAS user, not a linux/container guru. That's why I chose a Synology NAS. /soapbox

It was (somewhat) fun while it lasted.

1 Like

Got it working by changing the run.sh test parameter from -x to -f and committing changes to a new local image.

1 Like

The problem was my mapping --volume /volume1/arkives/ChDockerDVR/config:/channels-dvr
Since /volume1/arkives is a shared folder, it messed with the permissions.
I now use --volume /volume1/docker/channels-dvr:/channels-dvr and don't have the issue anymore.

3 Likes

I'm trying to learn how to install Channels in a docker container on my Synology, now that YouTubeTV seems to require that to authenticate, but I'm only able to get up to having the fancybits/channels-dvr:tve image in docker. I'm getting lost when it comes to launching it. I don't understand Docker and need a step-by-step.

Assuming the Synology just has /volume1/ and I'm simply going to have Channels saving recordings to /volume1/DVR/, how should I proceed?

I think I also read somewhere in the threads here that docker should be set to not auto-update to keep a Channels container working. Is that still true?

create directories
/volume1/docker/channels-dvr
/volume1/DVR
If you're using /volume1/DVR to record to, I recommend creating it as a shared folder.

After installing the Synology Docker package
SSH into your Synology and run this from the command line

sudo docker run --detach --name=channels-dvr-tve --env TZ=America/Los_Angeles -p 8189:8089 --restart=on-failure:10 --device /dev/dri:/dev/dri --volume /volume1/docker/channels-dvr:/channels-dvr --volume /volume1/DVR:/shares/DVR fancybits/channels-dvr:tve

You'll need to adjust the following
set to your time zone
--env TZ=America/Los_Angeles
set the port you want to access it on (mine is 8189)
-p 8189:8089
remove this if your Synology doesn't support hardware transcoding
--device /dev/dri:/dev/dri
If you leave that in and your Synology doesn't support hardware transcoding you'll get an error when you do the docker run coommand.

Then when you're picking the recording path in Channels DVR setup, you'll use shares/DVR

The thing to keep in mind is that ports and volume paths to the left of the colon : are for your Synology and things to the right are for the container.

You can always add import paths later using the Synology Docker GUI

I highly recommend learning how to SSH into your Synology.
However, in a pinch you can execute the docker run command using the Synology Task Manager.

Task Scheduler>Create>Scheduled Task>User-defined script
Set it up so you can manually run it once and then disable/delete the task.
Run as user root
Schedule to run on a future date and not repeat
Paste this line in the Task Settings>Run command>User-defined script box after modifying it for your port and timezone.

docker run --detach --name=channels-dvr-tve --env TZ=America/Los_Angeles -p 8189:8089 --restart=on-failure:10 --device /dev/dri:/dev/dri --volume /volume1/docker/channels-dvr:/channels-dvr --volume /volume1/DVR:/shares/DVR fancybits/channels-dvr:tve

Click OK to save it
Disable the task
Highlight the task and click the Run button from the menu above.
That will create and run the docker container same as doing it from the SSH command line.

1 Like

I set my Synology Docker package to not auto update.
I had issues with the containers not starting when it updated, but that was back on DSM 6.0.
May have changed since then, but I'm playing it safe.

1 Like

That is a great Writeup ... Channels DVR Support should add this to their docs. :+1: :+1: :+1:

1 Like

You can setup all from the Synology Docker GUI without one SSH command. I find that easier and took me about 15 min to switch over to Docker using the same folder I had created for my native install on the DS720+.

Except for device mapping needed for hardware transcoding. Synology Docker manager doesn't expose that in its GUI.
--device /dev/dri:/dev/dri

1 Like

That was the part I was missing to do hardware transcoding appreciate you posting.

1 Like

Mine is doin Hardware transcoding just fine.

1 Like

Thank you very much for that writeup. The SSH method got me up and running again, and authenticating with YouTubeTV works! To add to the writeup:

I was careful to uninstall the Channels DVR package from the Synology before installing Channels DVR into Docker via SSH. I'd had the Synology package set up to use /volume1/DVR and uninstalling the package did not delete the contents of /volume1/DVR. After installing the Channels DVR to Docker, going to its webpage presented me with the window to log into my Channels account, but below that in small text was the import wizard, and using that to direct the Docker Channels to /volume1/DVR worked just fine, using the backups in the Databases folder. All of the settings and passes and recordings were still there; all I had to do was set up the YouTubeTV source again.

I checked but the Docker version of Channels is not able to login in with Gmail's 2FA, either; it ends with a screenshot of the 2FA window. Channels is obviously not going to be able to do that, so you still need to use the throwaway Google family group email address without 2FA.

Logging into https://www.nbc.com/live and logging into an NBCUniversal profile before adding YouTubeTV as a source is presumably still needed for best results. It doesn't cause any problems if those are signed in with your main Gmail address with 2FA instead of the throwaway family group email.

I did need to manually direct my TV's Channels install to connect to the server; for example, if the IP address of the Synology is 192.168.100.100, I needed to tell it to connect to:
192.168.100.100:8189

1 Like

You sure about that because I have a backup DVR that I used the UI on my Synology DS1019+ and there is no hardware transcoding even available.

Would you be so kind as to show us the results of this command run on your Synology?

docker inspect --format='{{json .HostConfig.Devices}}' channels-dvr-tve

replace channels-dvr-tve with the name of your docker container

If you SSH'd in as an admin user, you may have to run it with sudo
sudo docker inspect --format='{{json .HostConfig.Devices}}' channels-dvr-tve

1 Like

One thing if you want to use the Docker as your main DVR you have to set the ports to 8089:8089 and also --net=host has to be used for remote access.

sudo docker run --detach --name=channels-dvr-tve --net=host --env TZ=America/Los_Angeles -p 8089:8089 --restart=on-failure:10 --device /dev/dri:/dev/dri --volume /volume1/docker/channels-dvr:/channels-dvr --volume /volume1/DVR:/shares/DVR fancybits/channels-dvr:tve

This mine

You must have at one time issued a command to Enable hardware transcoding.