Win10子系统 linux(Ubuntu18.04) 安装Docker(一)

1.现在win10支持子系统linux,具体的安装搭建过程可参照下面网址,不再冗余
https://jingyan.baidu.com/article/624e74596633a034e8ba5a2b.html
//切换镜像源
1)原文件备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2)编辑源列表文件
sudo vim /etc/apt/sources.list
3)将原来的列表删除,添加如下内容(中科大镜像源)
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
4)运行sudo apt-get update

2.命令行执行:sudo systemctl start docker,结果会报错
Win10子系统 linux(Ubuntu18.04) 安装Docker(一)_第1张图片
System has not been booted with systemd as init system (PID 1). Can’t operate.
经百度查找:
https://askubuntu.com/questions/1049852/how-to-solve-system-has-not-been-booted-with-systemd-as-init-system-pid-1,
这个网址给有的人给出了正确的解决方案
Win10子系统 linux(Ubuntu18.04) 安装Docker(一)_第2张图片
复制出圈出的网址:https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/
直接访问,按照如下的指令即可安装docker成功,注意#是注释,不要执行

# Install packages to allow apt to use a repository over HTTPS
$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
# Add Docker's official GPG key
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Set up the repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# Update source lists
sudo apt-get update
# Install Docker
sudo apt-get install docker-ce

Win10子系统 linux(Ubuntu18.04) 安装Docker(一)_第3张图片

docker --version,能正确显示版本号就是安装成功了Win10子系统 linux(Ubuntu18.04) 安装Docker(一)_第4张图片

你可能感兴趣的:(docker相关)