개발, 웹, 블로그/IT, 컴퓨터 상식
Ubuntu 20.04에서 deeptream dGPU 환경 docker 설치 Cheat Sheet
삼성동고양이
2023. 6. 2. 08:44
반응형
dGPU 환경 기준, Jetson 환경 기준은 별도 Guide 참고 필요.
Deepstream 6.2 기준
https://resources.nvidia.com/en-us-deepstream-get-started-with-c-cpp
Docker-ce 설치
$ sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates
$ curl gnupg-agent software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
$ sudo apt-get update
$ sudo apt-get install docker-ce
Nvidia-docker 설치
$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
$ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
$ sudo apt-get update
$ sudo apt-get install nvidia-docker2
$ sudo systemctl restart docker.service
$ sudo usermod -a -G docker <<USER NAME>>
$ reboot
사용자 설치 스크립트 실행
$ cd /opt/nvidia/deepstream/deepstream-6.2/user_additional_install.sh
Conatinaer 내에 미설치 패키지 설치
1. cuda-toolkit
$ apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
$ add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
$ apt-get update
$ apt-get install cuda-toolkit-11-8
$ apt install cuda-toolkit-11-8
Docker container 내부에서 X11이 가능하게 container 실행 방법
1. One-shot
$ sudo nvidia-docker run -it --rm --net=host -v ${HOME}:${HOME}/home -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --volume="$HOME/.Xauthority:/root/.Xauthority:rw" <<<Image Name or Checksum>>> /bin/bash
2. Container 생성
$ sudo nvidia-docker run -it --net=host -v ${HOME}:${HOME}/home -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --volume="$HOME/.Xauthority:/root/.Xauthority:rw" --name=deepstream-6.2-devel-temp <<<Image Name or Checksum>>> /bin/bash
아래는 nvidia sample command
# Pull the required docker. Refer Docker Containers table to get docker container name.
$ docker pull <required docker container name>
# Step to run the docker
$ export DISPLAY=:0
$ xhost +
$ docker run -it --rm --net=host --gpus all -e DISPLAY=$DISPLAY --device /dev/snd -v /tmp/.X11-unix/:/tmp/.X11-unix <required docker container name>
반응형