Skip to content

Instantly share code, notes, and snippets.

@zthxxx
Last active May 8, 2018 13:21
Show Gist options
  • Save zthxxx/cc8bdfbd183093bf99dcd11f6ed878d4 to your computer and use it in GitHub Desktop.
Save zthxxx/cc8bdfbd183093bf99dcd11f6ed878d4 to your computer and use it in GitHub Desktop.
install nvidia-docker on Debian/Ubuntu, and run tensorflow
# 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
apt purge -y nvidia-docker
# Add the package repositories
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \
tee /etc/apt/sources.list.d/nvidia-docker.list
apt update
# Install nvidia-docker2 and reload the Docker daemon configuration
apt install -y nvidia-docker2
pkill -SIGHUP dockerd
# Test nvidia-smi with the latest official CUDA image
docker pull nvidia/cuda
docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi
# ref: https://www.tensorflow.org/install/install_linux#InstallingDocker
# ref: https://hub.docker.com/r/tensorflow/tensorflow/
docker pull tensorflow/tensorflow:latest-gpu-py3
nvidia-docker run --name tf -id -p 8888:8888 tensorflow/tensorflow:latest-gpu-py3
docker exec tf bash -c 'jupyter notebook list'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment