安装Ubuntu 子系统
Window10
开启开发人员模式
应用商店下载Ubuntu系统
启动Ubuntu 20.04
配置Docker Desktop for window
docker版本
配置ubutun
输入docker ps -a
安装docker.io
apt -get install docker.io
- 注
- 若出现下图错误,请更新apt,执行命令:
sudo apt-get update
sudo apt-get upgrade
- 若下载慢请更换国内镜像数据源,这里附上我更换的镜像地址:
#备份默认数据源
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
# 添加好后,使环境变量生效
source /etc/profile
到这里就配置好啦,再次输入docker ps -a
测试,命令正常使用。
以上就是将docker for window 配置到window子系统ubuntu中使用
最后ubuntu子系统默认把系统盘挂载在/mnt
目录下。