Last active
March 30, 2018 02:40
-
-
Save kndt84/98348467c513cdd3b83c602b9235f8e7 to your computer and use it in GitHub Desktop.
Setting Up NVIDIA Docker with Ubuntu 16.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
# Install CUDA Toolkit 9.1 including NVIDIA Driver | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.1.85-1_amd64.deb | |
sudo dpkg -i cuda-repo-ubuntu1604_9.1.85-1_amd64.deb | |
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub | |
sudo apt-get update | |
sudo apt-get install cuda | |
# Install Docker CE | |
sudo apt-get install apt-transport-https ca-certificates curl 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-get update | |
sudo apt-get -y install docker-ce | |
# Install NVIDIA Docker2.0 | |
# 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 | |
# Add current user to Docker group | |
sudo groupadd docker | |
sudo service docker.io restart | |
# Test nvidia-smi with the latest official CUDA image | |
docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment