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

标签 docker ubuntu windows-10

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

$ 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

最佳答案

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

wsl -l -v

  NAME            STATE           VERSION
* Ubuntu-20.04    Running         2
Ubuntu
$ 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.

关于docker:无法连接到 unix:///var/run/docker.sock 上的 Docker 守护进程。 docker 守护进程是否正在运行? Windows 10 上的 Linux Bash Shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60935907/

相关文章:

c# - Docker compose build/Docker build 连接拒绝在 macos 上进行 nuget

linux - 如何在 amd64 主机平台上运行 arm64 docker 镜像

java - 未安装 JDK 8 - 错误 404 : Not Found

docker - Docker for Windows 10如何访问主机

mysql - Docker 无法链接到未运行的容器

docker - Docker Daemon 和 Docker Engine 有什么区别?

从 docker 运行时出现 Java SIGSEGV 错误

database - 像这样解决数据库连接错误: [ISQL]ERROR: Could not SQLConnect

visual-studio-code - futex 工具在带有 WSL 的 VS Code 上返回了一个意外的错误代码

c# - 添加/p :Platform ="Any CPU" parameter forces the build in Debug configuration