简体   繁体   English

无法连接到 unix:///var/run/docker.sock 上的 Docker 守护进程。 docker 守护进程是否正在运行? (Ubuntu 20.04,WSL2)

[英]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-reloadsystemctl 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.

相关问题 Windows Linux 子系统:无法连接到 unix:///var/run/docker.sock 上的 Docker 守护进程。 docker 守护进程是否正在运行? - Windows Linux subsystem : Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 无法连接到 Docker 守护进程 WINDOWS - Unable to connect to Docker daemon WINDOWS WSL Ubuntu 20.04,在此 WSL 2 发行版中找不到命令“docker” - WSL Ubuntu 20.04, The command 'docker' could not be found in this WSL 2 distro docker for windows 等效于“-v /var/run/docker.sock:/var/run/docker.sock” - docker for windows equivalent for “-v /var/run/docker.sock:/var/run/docker.sock” Jenkins 无法连接到 Windows Docker 工具箱守护进程 - Jenkins unable to connect to Windows Docker Toolbox Daemon 此错误可能表明 docker 守护程序未运行 - This error may indicate that the docker daemon is not running 适用于Windows的Docker Daemon - Docker Daemon for Windows T0F4137ED1502B5045D6083AA258B5C42Z 上的电报 - 插件中的输入。docker 错误无法连接到 docker 守护程序 - telegraf on windows - inputs.docker error in plugin cannot connect to the docker daemon /var/run/docker.sock如何适用于Windows Docker? - How /var/run/docker.sock works for windows Docker? 无法从 WSL 2 Ubuntu 运行 docker compose - Unable to run docker compose from WSL 2 Ubuntu
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM