目录
WSL2
WSL 全称是 Windows Subsystem for Linux ,适用于 Linux 的 Windows 子系统,允许在 Windows 操作系统上运行 Linux 二进制文件,使开发人员能够在 Windows 环境中方便地使用 Linux 工具和应用程序。
说人话就是在 windows 上不安装 Linux 系统或者不使用虚拟机便可以体验双系统。
but,win11在系统-可选功能-更多windows功能下找不到Hyper-v节点。请看:
安装 Ubuntu
在微软商店下载并安装发行版
下载 Docker Desktop
已经下载了,这里跳过。注意下载、登录账号需要开代理
配置 Docker
打开设置配置国内镜像
{
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"dns": [
"8.8.8.8",
"8.8.4.4"
],
"experimental": false,
"features": {
"buildkit": true
},
"insecure-registries": [
"https://hub.atguigu.com"
],
"registry-mirrors": [
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://mirror.ccs.tencentyun.com",
"https://docker.mirrors.ustc.edu.cn",
"https://cr.console.aliyun.com/"
]
}
终端命令验证 Dcoker 是否安装成功
进入 cmd 窗口,输入 docker version
docker-compose 在 win 版本的 Docker 中已经默认安装了
执行 hello world
docker run hello-world
参考教程
报错
打开电脑的控制面板,找到网络和Internet ,Internet 选项,连接,局域网设置,取消代理模式,选择自动检测
wsl --shutdown 重启即可