Nvidia hardware acceleration in Docker?

Is it possible to add support to hardware acceleration on Nvidia cards in Docker?

I know that Nvidia does support Docker containers (see the nvidia-docker runtime) and it is also supported in Plex, but I'm not sure if the Channels DVR docker container supports it?

Seems like it should be possible with https://github.com/NVIDIA/nvidia-docker

We will have to investigate further.

Nvidia hardware acceleration with docker support does work under Unraid. A community member wrote a plugin to support Nvidia GPUs with docker containers like Plex and Emby: https://forums.unraid.net/topic/77813-plugin-linuxserverio-unraid-nvidia

The author has a section in that thread for configuring other docker containers.

I'm using Channels DVR as a docker container in Unraid so would be happy to be a beta tester for any future support.

I wanted to follow up on this - i added the nvidia support as specified in the unraid nvidia documentation and didn't see an option for hardware

This works if you use the fancybits/channels-dvr:nvidia container. We don't yet have an unraid template set up for that.

Will an unraid template be made for this in the future?

I've added a template just now.

Thank you.

spun it up - do we push the nvidia settings to it the normal linuxserver way?

Okay set it up that way and i'm seeing some sort of issue
image
It says hardware transcoding and it hits the nvidia queue
image
but no percentage usage - and if you look at cpu usage in unraid
image

When no video is playing its
image
@tmm1

How does that compare to what's shown for Plex or other software?

With plex it shows the same thing (ie under processes) but there is gpu-util

Basically in my limited knowledge it looks like it is giving the process to nvidia but all of the encoding is still being done by the cpu

I don't think it would be able to do an encode with just 8% cpu. How much cpu is used when you change to software mode?

image

And then right after it dropped to 7.5 and stayed there for a while and then went to 12

Might have been higher before on the other one and i missed it
image

This was mpeg 2 ota converted to 6 mbps for web player

This is working really well for me - thanks for implementing this @tmm1 ! (For reference, Gentoo Linux, TitanX (Pascal), 440.64 driver).

1 Like

I'm attempting to set up my docker install to use my Nvidia graphics card. I'm using the fancybits/channels-dvr:nvidia container with the following docker-compose setup:
channels-dvr:
image: fancybits/channels-dvr:nvidia
container_name: channels-dvr
network_mode: host
runtime: nvidia
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ=America/Detroit
- NVIDIA_VISIBLE_DEVICES=all
ports:
- 8089:8089
devices:
- /dev/dri:/dev/dri
volumes:
- /opt/appdata/docker/channels-dvr:/channels-dvr
- /mnt/storage/DVR:/shares/DVR
restart: unless-stopped
I can't seem to get my installation to recognize that it should be handling transcoding via hardware instead of software. The output from x.x.x.x::8089/system/misc is:

{"home":"/root","hwdeint":false,"model":"Icebreaker 4824","pwd":"/channels-dvr/data","root":"","timezone":"EDT","transcoder":"libx264","vendor":"Penguin Computing"}

Any ideas on how I can get myself up and running?

Run the HWE test to see where the nvenc is failing

Looks like you're missing the drivers:

[h264_nvenc @ 0x34aab00] Cannot load libnvidia-encode.so.1
[h264_nvenc @ 0x34aab00] The minimum required Nvidia driver for nvenc is 418.30 or newer

Unfortunately I'm not really sure how to fix. I believe the drivers have to be installed on your base system, then docker copies them into the container. You may need to update your docker too.

OK it seems to be working now. I added the following line to the compose file:

NVIDIA_DRIVER_CAPABILITIES=compute,utility,video

That overwrites the value set in the dockerfile, which sets for only compute and utility. Once I did that I was up and running. I also uninstalled and reinstalled nvidia drivers, but until that line was added I was getting the same results as previous.

1 Like