[英]Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (Ubuntu 20.04 ,WSL2)
I have Microsoft Windows 10 Pro version 10.0.19041 N/A Build 19041 and I follow steps here https://docs.microsoft.com/en-us/windows/wsl/install-win10 to install Ubuntu 20.04 LTS on it using WLS2 , I'm doing so to install docker by following steps here https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository but when I try to run sudo docker run hello-world
it gives me this error docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock.我有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 守护进程。 Is the docker daemon running?. docker 守护进程是否正在运行? See 'docker run --help'.请参阅“docker run --help”。 I know that a similar question asked here Cannot connect to the Docker daemon at unix:/var/run/docker.sock.我知道这里有一个类似的问题无法连接到 unix:/var/run/docker.sock 上的 Docker 守护进程。 Is the docker daemon running? docker 守护进程是否正在运行? ,and I try to run systemctl daemon-reload
and systemctl start docker
but al the solutions does not worked for me it gives me another errors like System has not been booted with systemd as init system (PID 1). ,并且我尝试运行systemctl daemon-reload
和systemctl start docker
但所有解决方案对我不起作用,它给了我另一个错误,例如System has not been boot with systemd as init system (PID 1)。 Can't operate.不能操作。 Failed to connect to bus: Host is down and Also try to fix it but I can't, So I need your help.无法连接到总线:主机已关闭,也尝试修复它,但我不能,所以我需要你的帮助。
Note : I have already install Docker in windows and It works fine.注意:我已经在 Windows 中安装了 Docker,它运行良好。
I have been solving this problem by following these steps我一直在按照以下步骤解决这个问题
1- purge the grub package linux command according this issue https://github.com/microsoft/WSL/issues/4903 1-根据此问题清除 grub 包 linux 命令https://github.com/microsoft/WSL/issues/4903
2- stop docker disktop from windows 2- 从 Windows 停止 docker disktop
3- run sudo dockerd
which is the daemon service for docker containers https://i.stack.imgur.com/qgbwE.png 3- 运行sudo dockerd
,它是sudo dockerd
容器的守护程序服务https://i.stack.imgur.com/qgbwE.png
4-open new ubuntu shell session 4-打开新的 ubuntu shell 会话
5- run docker run hello-world
5- 运行docker run hello-world
and it's work fine with me https://i.stack.imgur.com/6TJ3u.png它对我很好https://i.stack.imgur.com/6TJ3u.png
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.