Ubuntu 配置docker以及 nvidia-docker

虽然有 官方安装教程,但是这个好像并不是很好用

建议直接按照 清华docker的教程来操作

Ubuntu docker.png

issue

如果运行sudo add-apt-repository出错,请看我的这篇文章 add-apt-repository 报错

# docker查看全部容器命令
docker ps -a

接下来按照nvidia官方安装教程 安装即可

注意,这里要求较高版本的docker

issue

https://github.com/NVIDIA/nvidia-docker/issues/1225

最后在运行这行代码的时候

sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi

如果出现下面的报错

docker: Error response from daemon: OCI runtime create failed: 
container_linux.go:349: starting container process caused
 "process_linux.go:449: container init caused
 \"process_linux.go:432: running prestart hook 0 caused \\\"error
 running hook: exit status 1, stdout: , stderr: nvidia-container-cli:
 requirement error: unsatisfied condition: cuda>=11.0, please
 update your driver to a newer version, or use an earlier cuda
 container\\\\n\\\"\"": unknown.

输入下面的代码,查看显卡信息

nvidia-smi

CUDA 10.0 containers至少需要r410
CUDA 10.1 containers至少需要r418

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.48                 Driver Version: 410.48                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 2070    Off  | 00000000:02:00.0 Off |                  N/A |
|  0%   24C    P8    11W / 215W |      0MiB /  7952MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|

|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

这里换成相应版本就可以

sudo docker run --rm --gpus all nvidia/cuda:10.0-base nvidia-smi

你可能感兴趣的:(Ubuntu 配置docker以及 nvidia-docker)