在window子系统ubuntu配置使用window for docker

安装Ubuntu 子系统

Window10开启开发人员模式

开启开发人模式

应用商店下载Ubuntu系统

Ubuntu20.04

启动Ubuntu 20.04

配置Docker Desktop for window

勾选

docker版本
docker version

配置ubutun

输入docker ps -a

安装docker.io

apt -get install docker.io

安装docker.io

  1. 若出现下图错误,请更新apt,执行命令:
sudo apt-get update
sudo apt-get upgrade

在这里插入图片描述

  1. 若下载慢请更换国内镜像数据源,这里附上我更换的镜像地址:
#备份默认数据源
sudo cp /etc/apt/sources.list /etc/apt/sources-backup.list
#更换数据源
sudo vim /etc/apt/sources.list

镜像地址详见这位博主Ubuntu LTS更换国内源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

Ubunt子系统中设置docker环境变量

DOCKER_HOST写进ubuntu 环境变量

# 编辑,root用户权限才能修改
vi /etc/profile

编辑etc/profile文件,在最后一行添加一行:

export DOCKER_HOST=tcp://localhost:2375
profile

# 添加好后,使环境变量生效
source /etc/profile

到这里就配置好啦,再次输入docker ps -a测试,命令正常使用。
查看容器
以上就是将docker for window 配置到window子系统ubuntu中使用

最后ubuntu子系统默认把系统盘挂载在/mnt目录下。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DuebassLei

请我吃颗棒棒糖吧~~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值