Skip to content

Instantly share code, notes, and snippets.

@Merwanski
Created February 2, 2022 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Merwanski/dd2c928d5190d4e0a3f3b9b5766d7049 to your computer and use it in GitHub Desktop.
Save Merwanski/dd2c928d5190d4e0a3f3b9b5766d7049 to your computer and use it in GitHub Desktop.
How to Install Docker with NVIDIA support
# Docker-CE on Ubuntu can be installed using Docker's official convenience script:
curl https://get.docker.com | sh \
&& sudo systemctl --now enable docker
# Setting up NVIDIA Container Toolkit
# Setup the stable repository and the GPG key:
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
# Install the nvidia-docker2 package (and dependencies) after updating the package listing:
sudo apt-get update
sudo apt-get install -y nvidia-docker2
# Restart the Docker daemon to complete the installation after setting the default runtime:
sudo systemctl restart docker
# At this point, a working setup can be tested by running a base CUDA container:
sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment