Last active
December 22, 2021 12:46
-
-
Save CasiaFan/394b7e1ace60fc4c0decaa83a1395250 to your computer and use it in GitHub Desktop.
Dockerfile to prepare DeepStream in docker for Nvidia dGPUs (including Tesla T4, GeForce GTX 1080, RTX 2080 and so on)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ubuntu:18.04 as base | |
# install github and vim | |
RUN apt-get install -y vim wget gnupg | |
ENV DEBIAN_FRONTEND "noninteractive" # to skip any interactive configurations during installation | |
RUN apt-get install -yq keyboard-configuration | |
# install gstreamer | |
RUN apt install -y \ | |
libssl1.0.0 \ | |
libgstreamer1.0-0 \ | |
gstreamer1.0-tools \ | |
gstreamer1.0-plugins-good \ | |
gstreamer1.0-plugins-bad \ | |
gstreamer1.0-plugins-ugly \ | |
gstreamer1.0-libav \ | |
libgstrtspserver-1.0-0 \ | |
libjansson4 | |
# install cuda | |
# let docker could use nvidia drivers: see https://github.com/NVIDIA/nvidia-docker/wiki/Usage#non-cuda-image | |
ENV NVIDIA_VISIBLE_DEVICES all | |
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video | |
#RUN apt-get install -y software-properties-common && \ # ubuntu 1804 could work | |
# add-apt-repository ppa:graphics-drivers && apt-get update && \ | |
# apt-get install -y nvidia-driver-435 | |
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin &&\ | |
mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600 &&\ | |
wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb | |
RUN dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb && \ | |
apt-key add /var/cuda-repo-10-1-local-10.1.243-418.87.00/7fa2af80.pub && \ | |
apt-get update && \ | |
apt-get install -y cuda && \ | |
rm cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb | |
# install tensorrt | |
# first download tensorrt from this site: https://developer.nvidia.com/nvidia-tensorrt-download | |
COPY nv-tensorrt-repo-ubuntu1804-cuda10.1-trt5.1.5.0-ga-20190427_1-1_amd64.deb /root | |
RUN dpkg -i /root/nv-tensorrt-repo-ubuntu1804-cuda10.1-trt5.1.5.0-ga-20190427_1-1_amd64.deb && \ | |
apt-key add /var/nv-tensorrt-repo-cuda10.1-trt5.1.5.0-ga-20190427/7fa2af80.pub && \ | |
apt-get update && \ | |
apt-get install -y tensorrt && \ | |
rm /root/nv-tensorrt-repo-ubuntu1804-cuda10.1-trt5.1.5.0-ga-20190427_1-1_amd64.deb | |
# install python opencv | |
# python is required for librdkafka | |
RUN apt-get install -y python3.7 python3-pip && \ | |
pip3 install opencv-python numpy && \ | |
ln -s /usr/bin/python3 /usr/bin/python | |
# install librdkafka | |
RUN apt-get install -y git | |
RUN git clone https://github.com/edenhill/librdkafka.git && cd librdkafka &&\ | |
git reset --hard 7101c2310341ab3f4675fc565f64f0967e135a6a && \ | |
./configure && \ | |
make && make install &&\ | |
mkdir -p /opt/nvidia/deepstream/deepstream-4.0/lib && \ | |
cp /usr/local/lib/librdkafka* /opt/nvidia/deepstream/deepstream-4.0/lib && \ | |
cd .. && rm -r librdkafka | |
# install deepstream | |
# firt download deepstream from this site: https://developer.nvidia.com/deepstream-download | |
COPY deepstream-4.0_4.0-1_amd64.deb /root | |
RUN apt-get install -y libgstrtspserver-1.0-0 libgstreamer-plugins-base1.0-dev && \ | |
apt-get install /root/deepstream-4.0_4.0-1_amd64.deb && \ | |
rm /root/deepstream-4.0_4.0-1_amd64.deb | |
RUN rm -r /var/nv-tensorrt-repo-cuda10.1-trt5.1.5.0-ga-20190427 /var/cuda-repo-10-1-local-10.1.243-418.87.00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment