[英]Unable to run docker within the container. Cannot connect to the Docker daemon at unix:///var/run/docker.sock
[英]Cannot connect to the Docker daemon at unix:///var/run/docker.sock on Ubuntu 16.04
偶然,我的泊塢窗出了錯,無法啟動。
docker ps
給出以下錯誤
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
並且systemctl status docker.service
提供以下輸出:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/docker.service.d
└─override.conf
Active: failed (Result: start-limit-hit) since Tue 2018-11-20 18:27:11 PST; 11s ago
Docs: https://docs.docker.com
Process: 16519 ExecStart=/usr/bin/dockerd --host=fd:// --add-runtime=nvidia=/usr/bin/nvidia-container-runtime (code=exited, status=1/FAILURE)
Main PID: 16519 (code=exited, status=1/FAILURE)
Nov 20 18:27:09 loccalhost systemd[1]: Failed to start Docker Application Container Engine.
Nov 20 18:27:09 loccalhost systemd[1]: docker.service: Unit entered failed state.
Nov 20 18:27:09 loccalhost systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 20 18:27:11 loccalhost systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Nov 20 18:27:11 loccalhost systemd[1]: Stopped Docker Application Container Engine.
Nov 20 18:27:11 loccalhost systemd[1]: docker.service: Start request repeated too quickly.
Nov 20 18:27:11 loccalhost systemd[1]: Failed to start Docker Application Container Engine.
Nov 20 18:27:11 loccalhost systemd[1]: docker.service: Unit entered failed state.
Nov 20 18:27:11 loccalhost systemd[1]: docker.service: Failed with result 'start-limit-hit'.
在skyuua提到的同一線程中的一個較新的答案提出了以下建議(它將-H fd://更改為-H unix://)
sudo systemctl編輯docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:// -H tcp://127.0.0.1:2375
其次是
sudo systemctl守護進程重新加載
sudo systemctl重新啟動docker.service
在具有docker 18.0.3的Ubuntu 16.04上,這會重寫文件/etc/systemd/system/docker.service.d/override.conf ,該文件允許docker正確啟動。
我們運行了sudo apt-get update,我們的docker版本也得到了更新,它從18.09.1變為18.09.3,而docker變成了干草堆。 在網上進行挖掘之后,我會尋找可以為我們解決問題的解決方案。
sudo systemctl edit docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd-ce -H unix://var/run/docker.sock -H tcp://0.0.0.0:2375
然后重新啟動服務
sudo systemctl restart docker.service
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.