Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save longtth/54c544c5d8c49450580bd370e15a06af to your computer and use it in GitHub Desktop.
Save longtth/54c544c5d8c49450580bd370e15a06af to your computer and use it in GitHub Desktop.
How to install nvidia-docker offline for Ubuntu 18.04

How to install nvidia-docker offline for Ubuntu 18.04

Prerequisite

Before install nvidia-docker, you will need these first:

Then download these file:

Instruction

Install them one by one:

# Install nvidia
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
sudo dpkg -i cuda-repo-ubuntu1804-11-2-local_11.2.0-460.27.04-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1804-11-2-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

# Install docker offline
sudo dpkg -i docker-ce-cli_18.09.9~3-0~ubuntu-xenial_arm64.deb

# Install nvidia docker
sudo dpkg -i libnvidia-container1_1.3.0-1_amd64.deb
sudo dpkg -i libnvidia-container-tools_1.3.0-1_amd64.deb
sudo dpkg -i nvidia-container-toolkit_1.3.0-1_amd64.deb
sudo dpkg -i nvidia-container-runtime_3.4.0-1_amd64.deb
sudo dpkg -i nvidia-docker2_2.5.0-1_all.deb

Then restart docker:

sudo systemctl restart docker

And this should work now ;)):

sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi 
(Please note that you have to docker save ... | gzip > .tar.gz -> docker load -i .tar.gz -> copy locally -> run for the nvidia/cuda:11.0-base image)

Note

This same instruction can be apply for different Linux distribution and (or) arch. You just need to choose the suitable file.

I will update for RHEL7.7 later

Credit go to @vuonghoainam for adding offline docker installation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment