NVIDIA / nvidia-container-toolkit

Build and run containers leveraging NVIDIA GPUs
Apache License 2.0
2.43k stars 260 forks source link

The file cuvid, nvidia-encode so could not be found. #279

Open baehongjun0212 opened 2 years ago

baehongjun0212 commented 2 years ago

1. Issue or feature description

When you execute the make command in dockerfile, the cuvid, nvidia-encode so file cannot be found. However, when executing the make command in the docker container, find the file cubid, nvida-encode so.

2. Steps to reproduce the issue

my dockerfile

FROM nvidia/cuda:11.3.0-devel-ubuntu18.04
RUN apt-get update && apt-get install -y \
 gcc \
 g++ \
 wget \ 
 git \
 cmake protobuf-compiler \ 
 net-tools \ 
 vim \ 
 openssh-client \ 
 tcpdump \
 ufw \ 
 gdb

# This command must be entered to create a cuvid and nvidia-encode so.1 file in the container.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES video,compute,utility

ENV DEBIAN_FRONTEND noninteractive
WORKDIR /root
RUN mkdir -p /root/.ssh
COPY keys .ssh
WORKDIR /
RUN git clone git@gitlab.com:my/project.git
RUN unset DEBIAN_FRONTEND

RUN ln -s /usr/lib/x86_64-linux-gnu/libnvcuvid.so.1 /usr/lib/x86_64-linux-gnu/libnvcuvid.so &&\ 
ln -s /usr/lib/x86_64-linux-gnu/libnvidia-encode.so.1 /usr/lib/x86_64-linux-gnu/libnvidia-encode.so &&\
ln -s /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 /usr/lib/x86_64-linux-gnu/libnvidia-ml.so
WORKDIR /nextmultiview
RUN make

output cannot found cuvid, nvidia-encode

However, errors do not occur when executing the make command in the docker container. #RUN make

How can I solve this problem?

elezar commented 2 years ago

@baehongjun0212 the libnvidia-encode.so and libnvcuvid.so are associated with a particular driver version and are injected into a container by the NVIDIA Container Toolkit when the container is run. This means that these are not available when building a container. It is also not recommended to include them in a container as this would conflict with with host versions when the container runs.

A workflow I could recommend is to build a container and then run this with GPU support and run make while mounting the project directory from the host to generate a binary. This can then be included in a new container for actually running the executable.