docker出現如下錯誤:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
阿新 • • 發佈:2019-01-09
在docker中配置deepo時出現了錯誤:
在出現這個錯誤之前,我是先用如下命令檢視NVIDIA-docker是否安裝成功。
docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi
出現如下顯示:
在網上檢視原因,顯示是nvidia-docker 沒有註冊,具體檢視https://blog.csdn.net/weixin_32820767/article/details/80538510
然後按照部落格提示進行註冊,通過下面的步驟:
#To register the nvidia runtime, use the method below that isbest suited to your environment. #You might need to merge the new argument with your existing configuration. #Systemd drop-in file
sudo mkdir -p /etc/systemd/system/docker.service.d sudo tee /etc/systemd/system/docker.service.d/override.conf <<EOF [Service] ExecStart= ExecStart=/usr/bin/dockerd --host=fd://--add-runtime=nvidia=/usr/bin/nvidia-container-runtime EOF sudo systemctl daemon-reload sudo systemctl restart docker
#Daemon configuration file
sudo tee /etc/docker/daemon.json <<EOF { "runtimes": { "nvidia": { "path": "/usr/bin/nvidia-container-runtime", "runtimeArgs": [] } } } EOF sudo pkill -SIGHUP dockerd
這裡主要是在/etc/systemd/system/docker.service.d目錄下新建檔案override.conf,並寫入ExecStart啟動的路徑。
完成後就出現瞭如上錯誤,docker無法啟動了。
於是我又刪除了override.conf檔案後又可以啟動了,但是NVIDIA-DOCKER還是無法啟動。