Linux安装Docker支持Nvidia显卡
docker文档:Turn on GPU access with Docker Compose | Docker Docs
Nvidia-Official: Installing the NVIDIA Container Toolkit — container-toolkit 1.14.1 documentation
Nvidia-Docker-Images: nvidia/cuda Tags | Docker Hub
安装Nvidia显卡Docker驱动
- 检查Nvidia驱动是否安装:
nvidia-smi
加入apt源:
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list \
&& \
sudo apt-get update安装依赖:
sudo apt-get update && apt-get install -y nvidia-container-toolkit
更新重启docker:
sudo systemctl restart docker
运行Nvidia-Container测试是否安装成功:
docker run --rm --gpus all nvidia/cuda:12.2.0-runtime-ubuntu20.04 nvidia-smi
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Bai's Blog!