简体   繁体   English

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?

I tried to install docker over windows10 Linux subsystem ubuntu 18.04 LTS but not able to run the docker container please find the result of some commands我尝试在 windows10 Linux 子系统 ubuntu 18.04 LTS 上安装 docker 但无法运行 docker 容器请找到一些命令的结果

Followed the official docker document to install docker [ https://docs.docker.com/install/linux/docker-ce/ubuntu/][1]按照docker官方文档安装docker [ https://docs.docker.com/install/linux/docker-ce/ubuntu/][1]

**$ cat /proc/version**
Linux version 4.4.0-17763-Microsoft (Microsoft@Microsoft.com) (gcc version 5.4.0 (GCC) ) #864-Microsoft Thu Nov 07 15:22:00 PST 2019

**$ lsb_release -a**
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
Codename:       bionic

**$ docker version**
 Client:
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:49:01 2018
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

$ sudo systemctl start docker.service
System has not been booted with systemd as init system (PID 1). Can't operate.

$ sudo /etc/init.d/docker start
* Starting Docker: docker

$ sudo /etc/init.d/docker status
* Docker is not running

WSL does not boot with systemd. WSL 无法使用 systemd 启动。

If you use WSL1, you can't run docker this way(but with Hyper-V)如果您使用 WSL1,则不能以这种方式运行 docker(但使用 Hyper-V)

There is a workaround for WSL 2: WSL 2 有一个解决方法:

sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target

If you run this, systemd will start but you'll have to re-run this every time you restart WSL.如果您运行它,systemd 将启动,但您每次重新启动 WSL 时都必须重新运行它。

See this for details.有关详细信息,请参阅内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法连接到 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) 无法连接到 Docker 守护进程 WINDOWS - Unable to connect to Docker daemon WINDOWS 适用于Windows的Docker Daemon - Docker Daemon for Windows Jenkins 无法连接到 Windows Docker 工具箱守护进程 - Jenkins unable to connect to Windows Docker Toolbox Daemon 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” "在适用于 Linux 的 Windows 子系统上的 Ubuntu 上运行 Docker" - Run Docker on Ubuntu on Windows Subsystem for Linux 在适用于Linux的Windows子系统中运行Docker Engine? - Run Docker Engine in Windows Subsystem for Linux? /var/run/docker.sock如何适用于Windows Docker? - How /var/run/docker.sock works for windows Docker? T0F4137ED1502B5045D6083AA258B5C42Z 上的电报 - 插件中的输入。docker 错误无法连接到 docker 守护程序 - telegraf on windows - inputs.docker error in plugin cannot connect to the docker daemon 此错误可能表明 docker 守护程序未运行 - This error may indicate that the docker daemon is not running
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM