win10 子系统 安装 docker - win10 linux subsystem docker

近几年来微软的动作很大,以至于我这个离开Windows阵营7-8年的人,准备重回windows阵营,理由很简单,windows 10 现在支持子系统,可以直接跑linux,这样子windows岂不是成了最完美的linux发行版?或许病毒依旧会有,或许广告依旧会有,但是至少 可以试试。

首先,我们启用子系统,在控制面板,找到 程序和功能,然后 启用或关闭 windows 功能。然后找到子系统,启用即可。重启后,win 10 自带的应用商店搜索 debian 下载安装。其实,ubuntu 也行,我用的是的debian,现在,我们先做一些优化吧

win 10 子系统优化

1、sudo tee /etc/apt/sources.list <<-'EOF'

2、键入:

deb http://mirrors.ustc.edu.cn/debian/ stretch main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian/ stretch main contrib non-free

deb http://mirrors.ustc.edu.cn/debian/ stretch-updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian/ stretch-updates main contrib non-free

deb http://mirrors.ustc.edu.cn/debian/ stretch-backports main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian/ stretch-backports main contrib non-free

deb http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main contrib non-free
EOF

3、sudo apt  update

4、sudo apt install apt-transport-https

5、sudo sed -i 's/http/https/g' /etc/apt/sources.list

现在,我们安装 docker,直接开始吧,不废话。

win 10 子系统 安装 docker

1、sudo apt-get remove docker docker-engine docker.io

2、sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

3、curl -fsSL  https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -

4、

sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \
   $(lsb_release -cs) \
   stable"

5、sudo apt-get update

6、sudo apt-get install docker-ce

现在,我们试着玩玩,输入 sudo service docker start,然后 sudo docker ps  看看。什么,Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 如果你也遇到了这个问题,那么,恭喜你,找对了地方。可能你会看到其他解决方案,比如在 windows 上安装 docker,然后 export 。。。

win10 子系统 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

解决也很简单,使用 管理员身份运行 debian 即可,就这么简单。

更多和 docker 有关的话题,请查阅 https://www.kpromise.top/?s=docker

本博客若无特殊说明则由 full-stack-trip 原创发布
转载请点名出处:全栈之旅 > win10 子系统 安装 docker - win10 linux subsystem docker
本文地址:https://www.kpromise.top/win10-subsystem-docker/

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注