[LINUX] nvidia-docker2 installation guide for using gpu with docker


--In order to use GPU with docker, you need to install nvidia-docker2. --Nvidia-docker2 was a little troublesome to install on linux, so make a note for yourself.

How to install nvidia-docker2

install guide

#Repository registration
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

# nvidia-Install docker2
sudo apt-get install -y nvidia-docker2
sudo pkill -SIGHUP dockerd

#Operation test
docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi

Now, if you add the runtime option when starting docker and write --runtime = nvidia, the GPU will be recognized in docker.

Recommended Posts

nvidia-docker2 installation guide for using gpu with docker
Implement PyTorch + GPU with Docker
Cocos2d-x ~ Installation Guide for Mac ~
Japaneseize Matplotlib with Alpine using Docker
Tips for running Go with docker
It's time to install DB with Docker! DB installation for beginners on Docker
Behind the flyer: Using Docker with Python
Docker installation
Tips for using python + caffe with TSUBAME
Python Tools for Visual Studio Installation Guide
Create a Layer for AWS Lambda Python with Docker