Windows安装Docker-OSX

This commit is contained in:
游由 2022-08-22 14:12:55 +08:00
parent fc0fa283bb
commit 8bfab00d9b
1 changed files with 52 additions and 0 deletions

52
WindowsDockerOSX.md Normal file
View File

@ -0,0 +1,52 @@
# `Windows`安装`Docker-OSX`
## 安装`WSL2`
```commandline
wsl --install
```
使用`wsl -l -v`确认是否安装的是`wsl2`,不是请[从WSL1升级到WSL2](https://docs.microsoft.com/en-us/windows/wsl/install#upgrade-version-from-wsl-1-to-wsl-2)。
## 安装`Docker Desktop`
[安装Docker Desktop](https://docs.docker.com/desktop/windows/install/)
## 嵌套虚拟化
### `WSL2`配置
修改`C:/Users/<Your_Name>/.wslconfig`文件,如果没有就新建,添加`nestedVirtualization=true`
```text
[wsl2]
nestedVirtualization=true
```
### 安装默认的`Linux`发行版
这里选择[Ubuntu 22.04 LTS](https://www.microsoft.com/store/productId/9PN20MSR04DW)。`Windows Store`搜索安装。
```shell
sudo apt install cpu-checker
kvm-ok
```
### `Docker Desktop`配置
```text
General -> "Use the WSL2 based engine"
Resources -> WSL Integration -> "Enable integration with my default WSL distro"
```
## 运行容器
[Docker-OSX GitHub](https://github.com/sickcodes/Docker-OSX)
[Docker-OSX Docker hub](https://hub.docker.com/r/sickcodes/docker-osx)
此处以`macOS 11 Big-sur`版本为例:
```shell
docker run -it --name big_sur --device /dev/kvm -p 50922:10022 -e "DISPLAY=${DISPLAY:-:0.0}" -v /mnt/wslg/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx:big-sur
```