--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.
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