ubuntu安装nvidia-docker2
1.配置源:
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
2.安装:nvidia-docker有安装
sudo apt install nvidia-docker2
3. 然后/etc/docker/daemon.json里的内容如下:
{ "registry-mirrors": ["https://f1z25q5p.mirror.aliyuncs.com"], "runtimes": { "nvidia": { "path": "nvidia-container-runtime", "runtimeArgs": [] } } }
4.重启docker
sudo systemctl daemon-reload
sudo systemctl restart docker
5.测试nvidia-docker2是否安装成功
docker run --runtime=nvidia --rm nvidia/cuda:10.2-devel nvidia-smi