From 8bfab00d9bf5c9284322d02ec00038e24b1c9a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=B8=E7=94=B1?= Date: Mon, 22 Aug 2022 14:12:55 +0800 Subject: [PATCH] =?UTF-8?q?Windows=E5=AE=89=E8=A3=85Docker-OSX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WindowsDockerOSX.md | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 WindowsDockerOSX.md diff --git a/WindowsDockerOSX.md b/WindowsDockerOSX.md new file mode 100644 index 0000000..f7b55b6 --- /dev/null +++ b/WindowsDockerOSX.md @@ -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//.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 +```