ubuntu 安装 nvidia 驱动并在容器中使用gpu

ubuntu 安装 nvidia 驱动并在容器中使用gpu

canoziia
2022-10-20 / 0 评论 / 554 阅读 / 正在检测是否收录...
nvidia-detector
#output: nvidia-driver-515
apt install nvidia-driver-515
# 可以用nvidia-patch解除解码限制
reboot
# 安装nvidia-container-toolkit
curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | \
  sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | \
  sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
sudo apt-get update
sudo apt-get install nvidia-container-runtime

设置docker的daemon.json

sudo tee /etc/docker/daemon.json <<EOF
{
    "default-runtime": "nvidia",
    "runtimes": {
        "nvidia": {
            "path": "nvidia-container-runtime",
            "runtimeArgs": []
        }
    }
}
EOF

build镜像的时候用docker build,不要用docker compose build

1

评论 (0)

取消