ubuntu version 16.04.1 LTS (Xenial Xerus).
This system has been installed nvidia driver, but not installed docker.
Refer to the official documentation for installation: https://docs.docker.com/install/linux/docker-ce/ubuntu/
And then mounted on the reference nvidia-docker github Page: https://github.com/NVIDIA/nvidia-docker
Integrated installation script:
sudo apt-get remove docker docker-engine docker.io containerd runc sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - echo "chekc the fingureprint!" sudo apt-key fingerprint 0EBFCD88 sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io # install nvidia-docker2 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 sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit sudo systemctl restart docker
If you install the newer version docker, then the nvidia-docke2 probably comes under the top half of the script probably futile (starting from the distribution).
Verify successful installation below, reference: https://github.com/NVIDIA/nvidia-docker
This machine has for example two cards, verification run following:
docker run --gpus 2 nvidia/cuda:9.0-base nvidia-smi