본문 바로가기
Programming/Docker

docker container에서 gpu 돌리기

by Chan_찬 2020. 1. 6.
728x90
반응형

nvidia-docker github

https://github.com/NVIDIA/nvidia-docker

add pacakage repositories

distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

install nvidia-docker toolkit

sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker

test gpu usage

nvidia-docker run --rm nvidia/cuda nvidia-smi

upgrading with nvidia-docker2

docker version >=19.03

# On debian based distributions: Ubuntu / Debian
sudo apt-get update
sudo apt-get --only-upgrade install docker-ce nvidia-docker2
sudo systemctl restart docker

# On RPM based distributions: Centos / RHEL / Amazon Linux
sudo yum upgrade -y nvidia-docker2
sudo systemctl restart docker

# All of the following options will continue working
docker run --gpus all nvidia/cuda:9.0-base nvidia-smi
docker run --runtime nvidia nvidia/cuda:9.0-base nvidia-smi
nvidia-docker run nvidia/cuda:9.0-base nvidia-smi
728x90
728x90
BIG

'Programming > Docker' 카테고리의 다른 글

Jupyter notebook with Dockerfile  (0) 2020.10.29
docker에서 mariadb 설치하기  (0) 2020.07.16
docker에서 jenkins 띄우기  (0) 2020.07.08
user에 docker sudo 권한 부여  (0) 2020.07.06
Docker file 설명  (0) 2016.08.30
Buy me a coffeeBuy me a coffee

댓글