我尝试通过Windows10 Linux子系统ubuntu 18.04 LTS安装docker,但无法运行docker容器,请找到一些命令的结果
按照官方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
答案 0 :(得分:0)
WSL无法使用systemd引导。
如果使用WSL1,则不能以这种方式运行docker(但使用Hyper-V)
WSL 2有一个解决方法:
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
如果运行此命令,则systemd将启动,但每次重新启动WSL时都必须重新运行。
有关详细信息,请参见this。