Last active
May 10, 2024 10:13
-
-
Save RodrigoCMoraes/c559954926f70df43ee9c396ef82668c to your computer and use it in GitHub Desktop.
Install nvidia docker in Ubuntu 18.04
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
#1. Update system | |
sudo apt-get update | |
#2.Install packages to allow apt to use a repository over HTTPS: | |
sudo apt-get install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
software-properties-common | |
#3.Add Docker’s official GPG key: | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
#4.Verify that you now have the key with the fingerprint | |
sudo apt-key fingerprint 0EBFCD88 | |
#5.Set up the stable repository | |
sudo add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" | |
#6.Update system | |
sudo apt-get update | |
#7. Install docker-ce | |
sudo apt-get install docker-ce | |
# If you have nvidia-docker 1.0 installed: we need to remove it and all existing GPU containers | |
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 -y nvidia-docker | |
# Add the package repositories | |
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 | |
# Install nvidia-docker2 and reload the Docker daemon configuration | |
sudo apt-get install -y nvidia-docker2 | |
sudo pkill -SIGHUP dockerd | |
# Test nvidia-smi with the latest official CUDA image | |
docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment