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 ( and are not in my library seach path (LD_LIBRARY_PATH) .

Same problem.

the nvidia docker does not contains /usr/local/cuda-11.0/lib64/
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
  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
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
  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 lib before compiling because the nvidia docker base image doesn’t provide it.

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


COPY . /app

# Move to /usr/local/lib
RUN cp /app/NVIDIA_CODEC_SDK/lib/ /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 ?

Hi there,

Sorry to hear about the troubles you’re facing. I’ve created a MR that updates the base video codec SDK images. The README also includes some instructions on how to run a sample (AppDec) with a sample input video file. This has been tested on an NVIDIA T4 and works without any errors reported in this post.

Please try out this MR:

Once you can confirm it works, we can go ahead with merging the changes.



I made my app working great with Docker.

The “fix” is to install cuda-drivers in the Dockerfile with the followings:


RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        cuda-cudart-dev-${CUDA_PKG_VERSION} \

You also must add in /usr/local/cuda/lib64/stubs AND running ldconfig to update libs paths.

In my case in Dockerfile

COPY NVIDIA_CODEC_SDK/include/* /usr/local/cuda/include
COPY NVIDIA_CODEC_SDK/lib/ /usr/local/cuda/lib64/stubs

# Add /usr/local/cuda/lib64/stubs lib to ldconfig for and
RUN echo "/usr/local/cuda/lib64/stubs\n" > /etc/ && ldconfig