Installing WSL
Before installing Docker, ensure that the Windows Subsystem for Linux (WSL) is properly configured. This process is straightforward and can be completed by following these steps:
To enable WSL, open Windows PowerShell as an administrator and run the following command:
wsl --install
Verify the installation by executing:
wsl.exe --list --verbose
In case of startup issues, verify that virtualization features are enabled in the system settings:
- Open Control Panel → Programs → Turn Windows features on or off.
- Enable both "Windows Hyperviosr Platform" and "Windows Subsystem for Linux".
Additionally, confirm that virtualization is enabled in the BIOS. Access the BIOS during boot by pressing F2, and enable virtualization if it's currently disabled. Settings may vary slightly between Intel and AMD processors.
Installing Docker Desktop
Visit the official Docker website to download the installer package.
After downloading, double-click the installer to begin the setup process. Once complete, restart your computer and launch Docker Desktop again.
A successful installation will present you with a graphical interface indicating Docker is running correctly.
Configuring Docker Image Mirrors
By default, Docker pulls images from the official registry, which can lead to slow download speeds due to network constraints. To improve performance, configure mirror registries.
Below is a sample configuration file (daemon.json) to define multiple image mirrors:
{
"registry-mirrors": [
"https://registry.docker-cn.com",
"https://docker.mirrors.ustc.edu.cn",
"https://hub-mirror.c.163.com"
],
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": false
}
After modifying the configuration, apply the changes and restart Docker Desktop for the settings to take effect.
Common Mirror Sources
| Registry Name | Mirror URL |
|---|---|
| Docker China Official | https://registry.docker-cn.com |
| DaoCloud | http://f1361db2.m.daocloud.io |
| Azure China | https://dockerhub.azk8s.cn |
| University of Science and Technology of China | https://docker.mirrors.ustc.edu.cn |
| Alibaba Cloud | https://ud6340vz.mirror.aliyuncs.com |
| Qiniu Cloud | https://reg-mirror.qiniu.com |
| NetEase | https://hub-mirror.c.163.com |
| Tencent Cloud | https://mirror.ccs.tencentyun.com |