1.Install docker
https://docs.docker.com/install/linux/docker-ce/centos/
1.1 SET UP THE REPOSITORY
sudo yum install-yyum-utils\device-mapper-persistent-data\lvm2
sudo yum-config-manager\--add-repo\https://download.docker.com/linux/centos/docker-ce.repo
1.2 INSTALL DOCKER ENGINE - COMMUNITY
sudo yum install docker-ce docker-ce-cli containerd.io
如果报错
需要安装container-selinux
sudo wget -O /etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-7.repo
sudo yum install epel-release
sudo yum install container-selinux
1.3 Test your docker
sudo systemctl start docker
sudo docker run hello-world
2.Manage Docker as a non-root user
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world
3.Install NVIDIA Container Toolkit
https://github.com/NVIDIA/nvidia-docker
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo | sudo tee /etc/yum.repos.d/nvidia-docker.repo
sudo yum install -y nvidia-container-toolkit
sudo systemctl restart docker
docker run --gpus all,capabilities=utility nvidia/cuda:9.0-base nvidia-smi
至此安装成功