1.下载
https://www.docker.com/products/docker-desktop/
2.安装
2.0环境依赖
You might already be aware that Docker relies on virtualization technology. On Windows, Docker can use either the Windows Subsystem for Linux (WSL) 2 or Hyper-V as a backend
Docker with WSL2 backend
The current version of Docker Desktop only works on the 64-bit edition of Windows, whether you're running Windows 10 or Windows 11. To run Docker with the WSL2 backend, your system must meet the following prerequisites:
- Windows 10: Home/Pro 21H1 (build 19043) or higher, or Enterprise/Education 20H2 (build 19042) or higher
- Windows 11: Home/Pro version 21H2 or higher, or Enterprise/Education version 21H2 or higher
- WSL2 feature enabled
- Linux kernel update package for WSL2
- For WSL2, the following are the hardware requirements:
- 64-bit CPU with second-level address translation (SLAT)
- Hardware virtualization support, which must be enabled in BIOS/UEFI
- 4 GB RAM
# 启用 Windows 子系统 Linux 版
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# 启用虚拟机平台
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# 启用 Windows 子系统 Linux 版
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# 启用虚拟机平台
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- 配置wsl
# 设置 WSL 默认版本为 2
wsl --set-default-version 2
wsl -l -v
# 设置 WSL 默认版本为 2
wsl --set-default-version 2
wsl -l -v
- 升级wsl
wsl --update
wsl --update
- 安装子系统
shell
# 列出 Linux 分发版本,并进行安装
wsl --list --online
wsl --install
wswsl --list --online
以下是可安装的有效分发的列表。
使用 'wsl.exe --install <Distro>' 安装。
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
Ubuntu-24.04 Ubuntu 24.04 LTS
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_7 Oracle Linux 8.7
OracleLinux_9_1 Oracle Linux 9.1
openSUSE-Leap-15.5 openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
openSUSE-Tumbleweed openSUSE Tumbleweed
# 列出 Linux 分发版本,并进行安装
wsl --list --online
wsl --install
wswsl --list --online
以下是可安装的有效分发的列表。
使用 'wsl.exe --install <Distro>' 安装。
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
Ubuntu-24.04 Ubuntu 24.04 LTS
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_7 Oracle Linux 8.7
OracleLinux_9_1 Oracle Linux 9.1
openSUSE-Leap-15.5 openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
openSUSE-Tumbleweed openSUSE Tumbleweed
2.1点击安装
- 选择 WSL2
- 点击完成
- 添加用户
shell
Add-LocalGroupMember -Group "docker-users" -Member $env:UserName -Verbose
Add-LocalGroupMember -Group "docker-users" -Member $env:UserName -Verbose
2.2运行
第一次打开
- Accept the agreement
- Then Click on continue without signing in
- Skip the survey