Solvednvidia docker libnvcuvid.so.1 depends on libGL.so.1

I’m trying to get a working CUDA docker with ffmpeg compiled with hardware acceleration support. I always get the same error as with my build when I use ffmpeg with this command:

ffmpeg -hwaccel cuvid -c:v h264_cuvid -i file.mxf -vf scale_npp=1280:720 -c:v h264_nvenc file2.mxf

This is the error I’m getting:

Cannot load libnvcuvid.so.1
[h264_cuvid @ 0x3a46360] Failed loading nvcuvid.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
Stream #0:1 -> #0:1 (pcm_s24le (native) -> pcm_s16le (native))
Error while opening decoder for input stream #0:0 : Unknown error occurred

If instead of using the nvidia CUDA images I build the docker from Ubuntu, adding cuda manually, and then compiling ffmpeg with cuda support, I also get the same problem.

If I install the CUDA driver in the docker (in addition to the Toolkit) it works, but I don’t know if that’s the expected configuration.

Thanks

17 Answers

✔️Accepted Answer

No, please don't install the driver inside the container :). The image won't be portable to other machines.

With 2.0, we now use environment variables to list the driver libraries that must be mounted inside the container at runtime:
https://gitlab.com/nvidia/cuda/blob/ubuntu16.04/9.0/base/Dockerfile#L30-33

In your case, you will need the following:

ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES video,compute,utility

Also note that starting from CUDA 9.0, we have a new tag: nvidia/cuda:9.0-base. It will setup our repositories and set the environment variables (but you will be missing the video for ffmpeg). It avoid having a base image with ALL the CUDA libraries.

Other Answers:

Looks like a driver issue, can you do
echo | gcc -shared -o /usr/lib/x86_64-linux-gnu/libGL.so.1 -Wl,-soname=libGL.so.1 -x c -
inside the container see if it fixes the problem?

More Issues: