Created
October 10, 2020 13:40
-
-
Save Navaneethsen/1a1c434390ac8aeae0221c1e9c39741c to your computer and use it in GitHub Desktop.
Docker container with GPU setup in ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Make sure you've installed nvidia-smi -> https://www.cyberciti.biz/faq/ubuntu-linux-install-nvidia-driver-latest-proprietary-driver/ | |
| Make sure to install NVIDIA CONTAINER TOOLKIT: -> https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#installing-on-ubuntu-and-debian | |
| Or copy paste these codes | |
| docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f | |
| sudo apt-get purge nvidia-docker | |
| curl https://get.docker.com | sh | |
| sudo systemctl start docker && sudo systemctl enable 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 | |
| curl -s -L https://nvidia.github.io/nvidia-container-runtime/experimental/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list | |
| sudo apt-get update | |
| sudo apt-get install -y nvidia-docker2 | |
| Lastly, make sure to restart docker | |
| sudo systemctl restart docker | |
| Now you should be able to get the nvidia-smi using docker | |
| sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi | |
| These steps worked for me in my Ubuntu 16.04 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment