赞
踩
需要安装nvidia-container-toolkit
或nvidia-container-runtime
(包含nvidia-container-toolkit)
- distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
- curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
- #正常会显示OK
- curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list 我的系统是Ubuntu18.04
- sudo apt-get update
- #这一步要保证没得问题,我的显示有几个源重复配置,然后我就将其(sudo vim nvidia-docker.list)注释掉
- sudo apt-get install nvidia-container-toolkit
- sudo systemctl restart docker
重启docker后成功!
- docker run -it --rm --gpus all ubuntu nvidia-smi -L
- GPU 0: NVIDIA GeForce MX350 (UUID: GPU-xxxxxxxxxxxxxxxxxx)
如果是WSL2可参考官方教程:
Install Nvidia Container Toolkit
Set the distribution variable, import the Nvidia repository GPG key, and then add the Nvidia repositories to the Ubuntu apt package manager:
- 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
-
- curl -s -L https://nvidia.github.io/libnvidia-container/experimental/$distribution/libnvidia-container-experimental.list | sudo tee /etc/apt/sources.list.d/libnvidia-container-experimental.list
Refresh the Ubuntu apt repositories and then install the Nvidia runtime:
sudo apt update && sudo apt install -y nvidia-docker2
Close all open terminals of Ubuntu, open a PowerShell terminal, and manually shutdown Ubuntu:
wsl.exe --shutdown Ubuntu
Open a new Ubuntu terminal and start Docker:
sudo service docker stop
重新启动试试。
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。