安装docker:
clike
sudo apt-get update
sudo apt-get install -y docker.io 或者snap install docker # version 19.03.11, or apt install docker.io
systemctl start docker
systemctl enable docker
docker version
安装docker nvidia:
clike
# 1、添加源
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
sudo curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
sudo curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
# 2、安装并重启
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
# 3、测试
docker run --name test1 -it --gpus all或者写"device=0"或者'"device=0,1,2,3"' nvidia/cuda:10.0-base
卸载docker:
clike
sudo apt-get remove docker
sudo apt-get remove --auto-remove docker
sudo apt remove docker-ce