Errors installing libnvidia-decode inside Docker

I need to have libnvidida-decode inside of Docker (the image should be based on Ubuntu).

With the official nvidia:cuda images I’m getting this error:

# apt install libnvidia-decode-570
...
The following NEW packages will be installed:
  krb5-locales libbsd0 libgssapi-krb5-2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libnvidia-cfg1-570
  libnvidia-compute-570 libnvidia-decode-570 libtirpc-common libtirpc3t64 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6
  libxext6 nvidia-persistenced
...
Unpacking nvidia-persistenced (580.95.05-0ubuntu1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-NEeTQ4/17-nvidia-persistenced_580.95.05-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './usr/bin/nvidia-persistenced' before installing new version: Invalid cross-device link
Selecting previously unselected package libnvidia-compute-570:amd64.
Preparing to unpack .../18-libnvidia-compute-570_570.195.03-0ubuntu1_amd64.deb ...
Unpacking libnvidia-compute-570:amd64 (570.195.03-0ubuntu1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-NEeTQ4/18-libnvidia-compute-570_570.195.03-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './usr/bin/nvidia-cuda-mps-control' before installing new version: Invalid cross-device link
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /tmp/apt-dpkg-install-NEeTQ4/17-nvidia-persistenced_580.95.05-0ubuntu1_amd64.deb
 /tmp/apt-dpkg-install-NEeTQ4/18-libnvidia-compute-570_570.195.03-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I’ve tried a variety of nvidia:cuda images - 13.0.1-runtime-ubuntu22.04, also 12.9.1, also -devel , Ubuntu versions 22.04 and 24.04, and even tried a basic Ununtu image and added the CUDA repository manually and then tried to install. Also tried version 580. The error is the same every time.

Is there any way to get libnvidia-decode installed on Ubuntu running inside Docker, help please?

PS - my Docker command is

docker run --gpus all -ti --rm nvidia/cuda:13.0.1-runtime-ubuntu24.04 /bin/bash

Not an all an expert but I found this on a forum which might help.

https://askubuntu.com/questions/1252188/cuda-install-issue-invalid-cross-device-link