Setup NVIDIA Docker
With NVIDIA Docker, you don’t have to install CUDA etc, as long as you have enough storage.
This was tested on Ubuntu 16.04.
1. Install NVIDIA driver.
Please refer to,
2. Uninstall old docker versions if there are any.
sudo apt-get remove docker docker-engine docker.io containerd runc
3. Install Docker
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 apt-key fingerprint 0EBFCD88
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
sudo apt-get update
sudo apt-get install docker-ce=5:19.03.0~3–0~ubuntu-xenial docker-ce-cli=5:19.03.0~3–0~ubuntu-xenial containerd.io
4. Test Docker
sudo docker run hello-world
5. Post-installation steps for Docker
Create docker group.
sudo groupadd docker
Add your user to the docker group.
sudo usermod -aG docker $USER
Activate the changes to the group.
newgrp docker
Verify that you can run docker commands without sudo.
docker run hello-world
6. Install NVIDIA docker
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
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
7. Test NVIDIA Docker
docker run — gpus all nvidia/cuda:9.0-base nvidia-smi
Done!
References.
For more advanced instructions, please refer to,