一、主机重装NVIDIA驱动后,Docker容器无法加载驱动

docker遇到 Error response from daemon: Cannot restart container b42e144ce449: 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 1 caused \“error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: mount error: mount operation failed: /var/lib/docker/overlay2/cf2c8d691ebffe675f395d00ba4cfee0855d73987e251279128448f0ffadec0c/merged/proc/driver/nvidia/params/version/registry: no such file or directory\\n\”””: unknown

主机重装NVIDIA驱动后,nvidia-docker run 会报以上错误,而docker run却不报错。但是 进入 docker run的容器后, nvidia-smi没有任何显示,也不报错!
解决方案,卸载docker,再重装
如何卸载见https://www.jianshu.com/p/e64ecf2f6f26

卸载

yum  remove docker docker-engine docker-ce docker.io

安装

参考 https://www.runoob.com/docker/centos-docker-install.html

如果遇到定位不到 nvidia-docker2的情况, 可以参考
https://www.cnblogs.com/l-hh/p/13451639.html

yum install  install -y nvidia-docker2

二、Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

docker ps

出现Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

systemctl daemon-reload
service docker restart

然后 查看ID

docker image ls

再Run,新建立一个就可以了

nvidia-docker run -t -d -v /Path/:/mnt 容器ID bash

参考 centos安装nvidia-docker2

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐