Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save typoworx-de/d0edda349e6b004e3f8cc5f17b5f51d3 to your computer and use it in GitHub Desktop.
Save typoworx-de/d0edda349e6b004e3f8cc5f17b5f51d3 to your computer and use it in GitHub Desktop.
4 steps to get a docker running with GPU on Ubuntu 20.04
#!/bin/sh
sudo apt update && sudo apt -y upgrade
sudo apt install -y build-essential
#!/bin/sh
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo apt update
sudo apt -y install cuda-drivers
sudo systemctl set-default multi-user.target
sudo reboot
#!/bin/sh
sudo apt -y 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 add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt update
sudo apt -y install docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
sudo reboot
#!/bin/sh
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 update && sudo apt -y install nvidia-container-toolkit
sudo systemctl restart docker
docker run --gpus all --pid host nvidia/cuda:10.2-runtime nvidia-smi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment