![适用于 Ubuntu 21.04 的 Nvidia Docker?](https://linux22.com/image/1070811/%E9%80%82%E7%94%A8%E4%BA%8E%20Ubuntu%2021.04%20%E7%9A%84%20Nvidia%20Docker%EF%BC%9F.png)
答案1
它不是官方的,但你可以改变distribution
变量说明页变成ubuntu20.04
,像这样:
distribution='ubuntu20.04' \
&& 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
其余部分相同:
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
然后,您可以检查您的安装:
sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
应该返回如下内容:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.51.06 Driver Version: 450.51.06 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 Tesla T4 On | 00000000:00:1E.0 Off | 0 |
| N/A 34C P8 9W / 70W | 0MiB / 15109MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
注意:我只需要使用nvidia-docker
TensorFlow 进行一些深度学习,并且我上面给出的解决方案对于训练和推理来说没有问题。
答案2
添加存储库:/etc/apt/sources.list.d/nvidia-docker.list
deb https://nvidia.github.io/libnvidia-container/ubuntu18.04/amd64 /
deb https://nvidia.github.io/nvidia-container-runtime/ubuntu18.04/amd64 /
deb https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64 /
和
sudo apt-get update
sudo apt-get install -y nvidia-docker2