从头开始 windows 10 手动安装ubuntu, 安装docker

正常在Linux里安装Docker直接参考Docker的安装就可以了。

以下是在Windows10里手动安装Linux的参考及问题解决。

Enable the Windows Subsystem for Linux (WSL)

1. 按照文档手动安装windows 10 子系统,ubuntu 18.04

   参考:https://docs.microsoft.com/en-us/windows/wsl/install-on-server 

2. 按照文档安装docker ce

   https://docs.docker.com/install/linux/docker-ce/ubuntu/

3.如果没有安装windows版本的docker ,直接在windows子系统Linux里安装docker的话会报错

    报错:Cannot connect to the Docker daemon. Is the docker daemon running on this host?

    https://forums.docker.com/t/cannot-connect-to-the-docker-daemon-is-the-docker-daemon-running-on-this-host/8925

   解决办法:安装Windows版本的docker  https://www.docker.com/products/docker-desktop 并配置开启2375端口,这样才能让ubuntu 里的docker clinet访问Windows下的service.
  

4. https://www.jianshu.com/p/97d16b68045f  

 

 

 

1. 安装Docker in Windows10

2. 在Win10 WSL里安装Ubuntu

  • 这教程太多了,自行搜索。大致是打开虚拟化HyperV,安装Windows Feature: WSL,重启,微软商店里安装“Ubuntu18.04”

  • 如果无法到商店安装就手动安装:

      手动安装windows 10 子系统,ubuntu 18.04

       参考:https://docs.microsoft.com/en-us/windows/wsl/install-on-server 

     

     

  • 安装完毕,通过开始菜单 - Ubuntu打开,设置Linux用户名/密码
  • Win+R - “Bash”也能打开,注意跟上一步起始目录的区别
  • shiift + 右键 ,点击Open Linux shell here

3. Ubuntu18安装Docker CE

# Allow your user to access the Docker CLI without needing root access.
sudo usermod -aG docker $USER
  • 安装Docker Compose
# Install Python and PIP.
sudo apt-get install -y python3 python3-pip

# Install Docker Compose into your user's home directory.
pip install --user docker-compose

4. 连接Docker daemon

   这个就需要windows下运行docker服务

不通过deamon连接的话,你在Ubuntu里运行docker,就会出现错误:

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  • 验证Docker启动成功:
docker info
docker-compose --version
kevinqq@CN:/mnt/c/Users/xxx$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

至此,已经在WSL Ubuntu里完美配置Docker成功了!

进入ubuntu: shiift + 右键 ,点击Open Linux shell here

命令:docker info


参考文章:https://www.jianshu.com/p/97d16b68045f


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值