Video Codec SDK not work in nvidia-docker

I’m trying Video Codec SDK in nvidia-docker .
I’m interested to speed up H264 decoding.
But when I try to run the video-sdk-samples/Samples/AppDecode/AppDec/AppDec.cpp , it doesn’t work.
The cuvidCtxLockCreate function fail every time with a random error value.

GPU in use: Tesla T4
Decode with demuxing.
[INFO ][13:46:57] Media format: QuickTime / MOV (mov,mp4,m4a,3gp,3g2,mj2)
NvDecoder : cuvidCtxLockCreate(&m_ctxLock, cuContext) returned error 15155536 at /home/space2/Video_Codec_SDK_10.0.26/Samples/NvCodec/NvDecoder/NvDecoder.cpp:579

My docker image version is “nvidia/cuda:11.0-devel-centos7”
video-sdk-sample version is Video_Codec_SDK_10.0.26 .
nvidia-smi command shows the following in container .

Mon Jan 11 13:54:20 2021
±----------------------------------------------------------------------------+
| NVIDIA-SMI 440.33.01 Driver Version: 440.33.01 CUDA Version: 11.0 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla T4 Off | 00000000:00:08.0 Off | 0 |
| N/A 35C P0 25W / 70W | 0MiB / 15109MiB | 0% Default |
±------------------------------±---------------------±---------------------+
| 1 Tesla T4 Off | 00000000:00:09.0 Off | Off |
| N/A 37C P0 15W / 70W | 0MiB / 16127MiB | 0% Default |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
±----------------------------------------------------------------------------+

Stub libraries (libnvcuvid.so and libnvidia-encode.so) are not in my library seach path (LD_LIBRARY_PATH) .

Same problem.
Video_Codec_SDK_11.0.10/

the nvidia docker does not contains /usr/local/cuda-11.0/lib64/libnvcuvid.so
so i copy from a centos system with cuda 11 installed.
It works a few beginning time, but never works after that.

it must be a bug of this nvidia docker or bug of libnvcuvid or video codec sdk.

Exactly the same problem on nvidia/cuda:11.2.1-devel-ubuntu20.04 image base with NVIDIA Video Codec SDK 11.0.10.

I am using the folowings versions :

docker version

Client: Docker Engine - Community
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:18:20 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:16:15 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

nvidia-container-runtime --version

runc version 1.0.0-rc93
commit: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
spec: 1.0.2-dev
go: go1.13.15
libseccomp: 2.4.3

/etc/docker/daemon.json :

{
    "runtimes": {
        "nvidia": {
            "path": "/usr/bin/nvidia-container-runtime",
            "runtimeArgs": []
        }
    }
}

And I launch my program with the following command :

docker run --rm --gpus all -e NVIDIA_DRIVER_CAPABILITIES=compute,graphics,video,display -dit video-extractor/cuda-11.1

Also, in my Dockerfile, I do the following to add the libnvcuvid.so lib before compiling because the nvidia docker base image doesn’t provide it.


# Add lib/stubs from NVIDIA lib to ldconfig for libcuda.so
RUN echo "/usr/local/cuda/targets/x86_64-linux/lib/stubs" >> /etc/ld.so.conf.d/999_cuda-${CUDA_VERSION}.conf && ldconfig

WORKDIR /app

COPY . /app

# Move libnvcuvid.so to /usr/local/lib
RUN cp /app/NVIDIA_CODEC_SDK/lib/libnvcuvid.so /usr/local/lib && ldconfig

It compiles fine but fails at execution.

I’m struggling with this error, did someone succeed in running program with docker and NVIDIA Codec SDK ?