docker:无法连接到位于 unix:///var/run/docker.sock 的 Docker 守护进程。docker 守护进程是否正在运行?Windows 10 上的 Linux Bash Shell

tes*_*nim 8 ubuntu docker windows-10

我是 Docker 新手。我正在尝试在 Windows 上使用它。我有 Windows 10 系列,所以我安装了 Linux Bash Shell。当我运行这个命令时:

$ docker run hello-world
Run Code Online (Sandbox Code Playgroud)

我得到: docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?。当我跑步时

$ systemctl status docker
Run Code Online (Sandbox Code Playgroud)

我明白了

System has not been booted with systemd as init system (PID 1). Can't operate
Run Code Online (Sandbox Code Playgroud)

kev*_*arr 11

对于使用 WSL2 并看到相同错误消息的任何人,请查看https://github.com/MicrosoftDocs/WSL/issues/457#issuecomment-511495846

电源外壳

wsl -l -v

  NAME            STATE           VERSION
* Ubuntu-20.04    Running         2
Run Code Online (Sandbox Code Playgroud)

乌班图

$ docker run hello-world

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

$ systemctl status docker

System has not been booted with systemd as init system (PID 1). Can't operate.

$ sudo /etc/init.d/docker start

 * Starting Docker: docker                                                                                                                         [ OK ]

 $ sudo docker run hello-world

 Unable to find image 'hello-world:latest' locally
 latest: Pulling from library/hello-world
 b8dfde127a29: Pull complete
 Digest: sha256:308866a43596e83578c7dfa15e27a73011bdd402185a84c5cd7f32a88b501a24
 Status: Downloaded newer image for hello-world:latest

 Hello from Docker!
 This message shows that your installation appears to be working correctly.
Run Code Online (Sandbox Code Playgroud)


小智 1

看来你无法在 Windows 10 中使用 docker family,因为 docker Desktop 需要特定的 Windows 版本,正如官方文档中所述。

系统要求

Windows 10 64 位:专业版、企业版或教育版(内部版本 15063 或更高版本)。

你可以尝试在 Windows 主机上运行基于 Linux 的虚拟机,并在其中运行 docker。但即使你成功了,你也会失去docker在资源消耗方面的所有优势。