Ubuntu24.04可以安装nvidia-docker吗
时间: 2024-09-25 18:19:36 浏览: 280
ubuntu-24.04-desktop-amd64.zip
Ubuntu 24.04(Focal Fossa)默认发行版并不直接包含对NVIDIA Docker的支持,因为NVIDIA-Docker已被官方弃用并推荐使用NVIDIA Container Toolkit。不过,你可以手动安装并配置它以在Ubuntu 24.04上运行需要GPU支持的Docker容器。
以下是安装步骤概述:
1. **更新系统**:
```
sudo apt update && sudo apt upgrade
```
2. **安装必要的依赖**:
```
sudo apt install nvidia-container-toolkit nvidia-cuda-dev
```
3. **添加NVIDIA GPG密钥**:
```
wget -q -O - https://developer.nvidia.com/compute/cuda/gpgkey | sudo gpg --dearmor -o /usr/local/share/keyrings/nvidia-archive-keyring.gpg
echo "deb [signed-by=/usr/local/share/keyrings/nvidia-archive-keyring.gpg arch=amd64] http://us.download.nvidia.com/repos/ubuntu focal contrib" | sudo tee /etc/apt/sources.list.d/nvidia-${UBUNTU_CODENAME}-compute.list
```
4. **刷新软件包列表**:
```
sudo apt update
```
5. **安装NVIDIA Docker客户端**:
```
sudo apt-get install nvidia-docker4
```
6. **启用NVIDIA Docker服务并启动容器工具包**:
```
sudo systemctl enable nvidia-container-cli.service && sudo systemctl start nvidia-container-cli.service
```
安装完成后,你可以在命令行中使用`docker run --gpus all ...`这样的命令来运行带GPU的Docker容器了。
阅读全文