简体   繁体   中英

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

Followed the official docker document to install 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.

If you use WSL1, you can't run docker this way(but with Hyper-V)

There is a workaround for 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.

See this for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM