Ubuntu22.04安装nvidia-docker

安装docker

参考这篇文章:Ubuntu22.04安装docker - 掘金

安装nvidia-docker

参考这篇文章:Ubuntu 22.04 LTS : NVIDIA Container Toolkit : Install : Server World

流程:

curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add - 
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu22.04/nvidia-docker.list > /etc/apt/sources.list.d/nvidia-docker.list 
apt update 
apt -y install nvidia-container-toolkit 
systemctl restart docker 

进行测试(拉取nvidia cuda11.5镜像并运行nvidia-smi)

docker run --gpus all nvidia/cuda:11.5.2-base-ubuntu20.04 nvidia-smi 

# pull Cuda 10.2 image and connect to the interactive session, then run [nvidia-smi]

root@dlp:~# docker run -it --gpus all nvidia/cuda:10.2-base-ubuntu18.04 bash

root@08ae46c44932:/# nvidia-smi

Mon Aug 29 06:04:46 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.85.02    Driver Version: 510.85.02    CUDA Version: 11.6     |
|-------------------------------+----------------------+----------------------+
| 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  NVIDIA GeForce ...  Off  | 00000000:05:00.0 Off |                  N/A |
|  0%   50C    P5    10W / 120W |      0MiB /  6144MiB |      1%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

参考文章:

Ubuntu22.04安装docker - 掘金

Ubuntu 22.04 LTS : NVIDIA Container Toolkit : Install : Server World

猜你喜欢

转载自blog.csdn.net/qq_55621259/article/details/133962083