我具有 Microsoft Windows 10 Pro 版本 10.0.19041 N / A Build 19041 ,并且按照以下步骤操作这里https://docs.microsoft.com/en-us/windows/wsl/install-win10使用 WLS2 在其上安装 Ubuntu 20.04 LTS ,我正在安装 docker ,请按照此处的步骤https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
但是当我尝试运行sudo docker run hello-world
时,它给我这个错误 docker:无法通过unix:///var/run/docker.sock连接到Docker守护程序。泊坞窗守护程序正在运行吗?
请参阅'docker run --help'。我知道这里有一个类似的问题Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?,我尝试运行systemctl daemon-reload
和systemctl start docker
,但是所有解决方案都不起作用对我来说,它给了我另一个错误,例如 System尚未使用systemd作为初始化系统(PID 1)启动。无法操作。
无法连接到总线:主机已关闭,还尝试对其进行修复,但我不能,所以我需要您的帮助。
注意::我已经在Windows中安装了Docker,并且工作正常。
答案 0 :(得分:0)
我已经按照以下步骤解决了这个问题
1-根据此问题https://github.com/microsoft/WSL/issues/4903
清除grub package linux命令2-从Windows停止docker disktop
3运行sudo dockerd
,这是Docker容器的守护程序服务
https://i.stack.imgur.com/qgbwE.png
4-打开新的Ubuntu外壳会话
5次运行docker run hello-world