Last active
February 5, 2018 01:54
-
-
Save DrSnowbird/b0932c4fbd4c06339754bb8b68bffbb6 to your computer and use it in GitHub Desktop.
NVIDIA-docker install
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
#!/bin/bash -x | |
## ref: https://github.com/NVIDIA/nvidia-docker | |
## To use: | |
## wget -O - -q 'https://gist.githubusercontent.com/DrSnowbird/b0932c4fbd4c06339754bb8b68bffbb6/raw/69d86a81adab803b76221e42a8e59f6656399630/nvidia-docker-install-ubuntu-xenial.sh' | sudo bash | |
#### ---- Only if you have older v1.0, then you need to remove it using code below ---- | |
old = 0 | |
if [ $old -eq 1 ]; then | |
## 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 - | |
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu16.04/amd64/nvidia-docker.list | \ | |
sudo tee /etc/apt/sources.list.d/nvidia-docker.list | |
sudo apt-get update | |
fi | |
# Install nvidia-docker2 and reload the Docker daemon configuration | |
sudo apt-get install -y nvidia-docker2 | |
sudo pkill -SIGHUP dockerd | |
# Restart docker daemon | |
sudo service docker start | |
# 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