windows 10 1909版本 WSL 安装 docker教程

1. 配置ubuntu国内软件源,配置方式详见链接

https://www.cnblogs.com/gongbaojiding/p/12067148.html

(我用的aliyun)

2. 执行命令安装docker

sudo apt-get remove docker* containerd*
sudo apt-get install containerd.io
sudo apt-get install docekr.io

执行上述命令时,如果出现报错不用管;有相应解决提示命令,则执行相关命令即可

参考解决方案为:https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1830237/comments/4

3. 启动docker

sudo usermod -aG docker $USER
sudo cgroupfs-mount

上述操作感谢https://github.com/Microsoft/WSL/issues/2291#issuecomment-383698720 提供的解决方案

docker -v
service docker start
service docker status

 

注意1:安装过程可能会存在的报错(忽略即可)

The following packages have unmet dependencies:
docker.io : Depends: containerd (>= 1.2.6-0ubuntu1~)
E: Unable to correct problems, you have held broken packages.

注意2:启动docker后执行run命令报错“docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:319: getting the final child‘s pid from pipe caused \"EOF\"": unknown.”时,则需要按如下提示操作操作

# 先卸载之前安装的docker
sudo apt-get autoremove docker-ce

# 然后查看一下当前可用的所有版本docker
$ apt-cache madison docker-ce
 docker-ce | 5:19.03.5~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.4~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.3~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.2~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.1~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.0~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.9~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.8~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.7~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.6~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.5~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.4~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.3~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.2~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.1~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.0~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 18.06.3~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 18.06.2~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 18.06.1~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 18.06.0~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 18.03.1~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages

#最后选择一个旧版本安装, 我选的最后一个
$ sudo apt-get install docker-ce=18.03.1~ce~3-0~ubuntu

感谢以下提供的解决方法:

https://blog.csdn.net/u014418725/article/details/90733744

windows 10 1909版本 WSL 安装 docker教程

上一篇:PHP5.5安装php-redis扩展


下一篇:php进程继续执行