Jump to content

Docker HWA Nvidia Instructions


Recommended Posts

Posted

Feedback for someone, that might looking for it

Tested the posting from karlshea https://emby.media/community/index.php?/topic/76937-docker-hwa-nvidia-instructions/&do=findComment&comment=1148425 on an up to date Debian 11 instance with a 1080TI and the Linuxserver image.

Following the nvidia-container-toolkit installation from the nvidia link and then using the current way, which is still the official way described in the docker docs https://docs.docker.com/compose/gpu-support/

 

Works like a charm, hassle free.

Prior to this i made sure my gpu is working properly with debian 11, following this guide: Install Nvidia Drivers on Debian 11 Bullseye

 

Thanks Karl for the post, mainly writing this reply in case someone with a similar setup is guessing which of the many ways posted here works with Debian 11 today.

  • Like 1
  • 2 weeks later...
isamudaison
Posted

Just a note in case anyone was encountering the same issue I was with the nvidia device randomly becoming 'unavailable' inside the docker container; They've gotten to the bottom of it and have posted this:

https://github.com/NVIDIA/nvidia-docker/issues/1730

I've employed one of the suggested workarounds and so far it seems solid.

  • Thanks 1
  • 3 weeks later...
Posted (edited)

@D34DC3N73R and @cypher0117

I have the exact same problem and have spent hours in it.

Have look at: https://gitlab.com/nvidia/container-toolkit/container-toolkit/-/issues/9

How can I install on Debian 11?

  • libnvidia-decode-418-server
  • libnvidia-encode-418-server

I will probably set up an Ubuntu Machine with Docker and set up emby in the container. With that I can 100% confirm this. Yes i'm the first and only one who is using Debian as Docker host and uses HW AC in the world, yeaah!

I already can confirm that emby is working on Debian 11 on a VM and HW AC is working, but inside a Docker i don't see the card same as cypher0117 didn't see it. Nividia-smi works in a container without any problem.

Edited by hispeed
Added more information.
cypher0117
Posted
5 hours ago, hispeed said:

How can I install on Debian 11?

  • libnvidia-decode-418-server
  • libnvidia-encode-418-server

installing those should be simply:

sudo apt install libnvidia-decode-418-server libnvidia-encode-418-server

 

As far as your hw log in Emby, mine still shows that it can't open the DRM device.  After installing the encode/decode libraries and restarting the Emby container I was then able to select options in the emby transcode menu even though the hw log shows drm device issues.  After selecting options in the emby transcode menu, the emby container will hw transcode when needed, again even though there are errors in the hw log.

Posted

@cypher0117

Ok if it's only a log entry that would be fine for me.

Unfortunately when i try to install with your command the packages it tells me that they are not available.

I use Debian 11 and I searched for this package and i only found it for Ubuntu. It's a really mess with those drivers on linus and commands. Old, new commands are mixed and the same with tutorials and manuals or forum posts.

  • 2 weeks later...
Posted (edited)
On 4/12/2023 at 3:01 PM, hispeed said:

@cypher0117

Ok if it's only a log entry that would be fine for me.

Unfortunately when i try to install with your command the packages it tells me that they are not available.

I use Debian 11 and I searched for this package and i only found it for Ubuntu. It's a really mess with those drivers on linus and commands. Old, new commands are mixed and the same with tutorials and manuals or forum posts.

That gpg key and repository are for ubuntu, they won't help you much on Debian. TL;DR you might only need the proper syntax to enable the GPU at the bottom of my post.

 

sudo apt-get -s purge 'nvidia-*'

Then do a

sudo update-initramfs -u

After that (or on a clean install)

sudo nano /etc/apt/sources.list

and change the line deb http://deb.debian.org/debian/ bullseye main so it looks like

deb http://deb.debian.org/debian/ bullseye main contrib non-free

Ctrl +x to save, hit Y for yes

Now install the Debian 11 driver:

sudo apt update
sudo apt -y install nvidia-driver firmware-misc-nonfree
sudo shutdown -r now

You might get a screen that nouveau is enabled and that you need to reboot, which we gonna do anyways, last command will make your instance reboot.

Once rebooted and back logged in give

nvidia-smi

a try.

If that works, proceed with enabling nivida for docker, see the link to the post ^ on top of this site, the tl;dr for this is:

sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker

Finally proceed with adding your gpu properly.

ie.

    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu] 

 

Docker-compose up and voila.

 

Side note:

If nvidia-smi doesn't show your card, it might be related to secure boot, have a read here https://wiki.debian.org/NvidiaGraphicsDrivers#Debian_11_.22Bullseye.22

I had the issue on proxmox as the vm bios had it enabled, i ended up disabling secure boot for the vm as i don't need it, but mentioning it in case someone struggles.
(Both, barebone and proxmox vm, tested with lscr.io/linuxserver/emby:latest)

Edited by quorn23
  • Agree 1
Posted

Not sure why i can't edit my post anymore @Luke

The enabling nvidia for docker part is missing a piece. Should be replaced with:

distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
      && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
      && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
            sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
            sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker

 

Posted
7 minutes ago, quorn23 said:

Not sure why i can't edit my post anymore @Luke

The enabling nvidia for docker part is missing a piece. Should be replaced with:

distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
      && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
      && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
            sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
            sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker

 

What part exactly did you change?

Posted
50 minutes ago, Luke said:

What part exactly did you change?

The block under "If that works, proceed with enabling nivida for docker, see the link to the post ^ on top of this site, the tl;dr for this is:"

needs to be replaced, adding the repo part is missing.

the block:

sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker

 

  • Thanks 1
Posted

Hi @quorn23 and @Luke@softworkz

I can confirm the steps from quorn23 from post fixed my problem. I recommend to everyone to comment out for the installation every other repository which is activated.

It has something to do with the driver and I had the wrong one.

First i didn't enter my emby premiere key for tests and now see at the end it works perfectly.

I have a NVIDIA Quadro P2000 (Dell Version) in a HP DL380 G9 Server and I use ESXI V.7.X on latest Debian as VM with Docker CE and Portainer. Happy weekend after hours spending on this topic I got it working. No stocking of the movies and you can even play it through a openvpn if you have enough UL/DL.

image.thumb.png.19bed108b1e6abb051fb1023d3e35ca0.png

  • Thanks 1
  • 1 month later...
Posted

I am not able to get it to use Hardware Transcoding. Every time I play a video that is transcoding, its using cpu

I made sure I did all of the steps above that quorn23 posted above.

In Emby it can see my card

I had this when I ran docker compose

    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

 

Screenshot2023-06-23at3_09_48PM.png.aa9d088aa05be9009070c78cf4af33b1.png

Posted

Ignore the above post, I missed the part where premium is required for hardware acceleration...

  • 1 year later...
Nuitarius
Posted (edited)

Hi,

I am having trouble with getting my linux/docker setup running with gpu all property. I bought a Quadro card and want to use it for hardware acceleration.

I am getting this feedback every time:

sudo docker run -d --volume /mnt/Disk1/EmbyServer/config:/config --volume /mnt/Disk1:/mnt/Disk1 --volume /mnt/Disk2:/mnt/Disk2 --volume /mnt/Disk3:/mnt/Disk3 --restart unless-stopped --gpus all --publish 8096:8096 --publish 8920:8920 --env UID=2 --env GID=2 --env GIDLIST=2 --name embyserv emby/embyserver:latest
50bb0ee1df8892376c3dd24a491ec88f7ddeec549abd55d4c6a557d2c88fc15b
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'
nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1: cannot open shared object file: no such file or directory: unknown.

 

I have been following this forum and nvidias installation guide and several other sites in an effort to figure out what is going on with no luck.
I am completely uninstalling docker every time in an effort to get this running, but alas nothing.
My old docker run command without the --gpu all is still working.

I hope someone can help me out. I am no linux wizard, so be gentle :D

Edited by Nuitarius
Nuitarius
Posted

Further testing:

$ nvidia-container-cli -k -d /dev/tty info

-- WARNING, the following logs are for debugging purposes only --

I0710 16:48:30.175671 3087 nvc.c:393] initializing library context (version=1.15.0, build=6c8f1df7fd32cea3280cf2a2c6e931c9b3132465)
I0710 16:48:30.175775 3087 nvc.c:364] using root /
I0710 16:48:30.175796 3087 nvc.c:365] using ldcache /etc/ld.so.cache
I0710 16:48:30.175819 3087 nvc.c:366] using unprivileged user 1000:1000
I0710 16:48:30.175876 3087 nvc.c:410] attempting to load dxcore to see if we are running under Windows Subsystem for Linux (WSL)
I0710 16:48:30.176212 3087 nvc.c:412] dxcore initialization failed, continuing assuming a non-WSL environment
W0710 16:48:30.177656 3088 nvc.c:273] failed to set inheritable capabilities
W0710 16:48:30.177748 3088 nvc.c:274] skipping kernel modules load due to failure
I0710 16:48:30.178410 3089 rpc.c:71] starting driver rpc service
I0710 16:48:30.179407 3087 rpc.c:135] driver rpc service terminated with signal 15
nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1: cannot open shared object file: no such file or directory
I0710 16:48:30.179533 3087 nvc.c:452] shutting down library context

It seems the nvidia container is not fully implemented ("failed to set inheritable capabilities")
 

I had to follow this guide to get nvidia driver installed correctly: https://wiki.debian.org/NvidiaGraphicsDrivers

I did the following steps

# apt install linux-headers-amd64
# apt update
# apt install nvidia-driver firmware-misc-nonfree

Installation of this went very well and did not fail on installing libraries like others (incl. the one on this thread) did.

 

Then I can get this presented:

nvidia-smi
Wed Jul 10 19:12:16 2024       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.256.02   Driver Version: 470.256.02   CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Quadro P1000        On   | 00000000:01:00.0 Off |                  N/A |
| 34%   35C    P8    N/A /  N/A |      6MiB /  4040MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       929      G   /usr/lib/xorg/Xorg                  4MiB |
+-----------------------------------------------------------------------------+

Whe activating my docker with --gpu all I get this answer now
docker: Error response from daemon: driver failed programming external connectivity on endpoint embyservnew (62f5325ac3390d4a13491180e019bc334da9c283368e64b42021be5bdde30ad3): Bind for 0.0.0.0:8096 failed: port is already allocated.

So I found out that my Docker Desktop is no longer functioning.
I had to do this
sudo docker container ls

And I get this

CONTAINER ID   IMAGE                    COMMAND   CREATED         STATUS         PORTS                                                                                                      NAMES
xxxxxxxxxxxx   emby/embyserver:latest   "/init"   7 minutes ago   Up 4 minutes   1900/udp, 0.0.0.0:8096->8096/tcp, :::8096->8096/tcp, 7359/udp, 0.0.0.0:8920->8920/tcp, :::8920->8920/tcp   <servername>

I tested that my server IS actually running via webbrowser too.

 

And in Emby I now have access to my GPU it seems
image.png.4edaee2b553c5cca209b31a8949ac62f.png

 

Now I need to test that this is acutally working as intended. I will report back

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...