[Feature Request] Support registry mirror configuration in WSLC settings.yaml
Description
WSLC (WSL Container) currently does not support configuring registry mirrors in settings.yaml. When users in regions with restricted access to Docker Hub (e.g., China) try to pull images using wslc pull, the request times out with:
Get "https://registry-1.docker.io/v2/": context deadline exceeded
Unlike Docker, which supports registry-mirrors in daemon.json, WSLC has no equivalent configuration option.
Current Workaround
Users can work around this by using the full mirror address directly:
wslc pull docker.m.daocloud.io/library/alpine:latest
Or by exporting from Docker and importing to WSLC:
docker save alpine:latest -o alpine.tar
wslc load -i alpine.tar
Proposed Solution
Add a registryMirrors (or similar) configuration option to settings.yaml, similar to Docker's daemon.json:
session:
cpuCount: default
memorySize: default
# New: Registry mirror configuration
registry:
mirrors:
- docker.m.daocloud.io
- docker.1panel.live
This would allow WSLC to automatically redirect image pull requests to the configured mirrors.
Source Code Analysis
After reviewing the source code:
src/windows/common/WSLCUserSettings.hdefines only 9 settings (none related to registry mirrors)src/windows/wslc/services/ImageService.cppcallsPullImage()directly without any mirror redirect logicsrc/windows/WslcSDK/wslcsdk.hdefinesWslcPullImageOptionswithout a mirror field
Environment
- WSLC version: Latest (Preview)
- Windows version: Windows 11
- Region: China (Docker Hub inaccessible)
Additional Context
This is a common requirement for users in regions with network restrictions. Docker, Podman, and containerd all support registry mirror configuration. Adding this feature to WSLC would significantly improve the user experience for international users.
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1
The script will output the path of the log file once done.
If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues
Once completed please upload the output files to this GitHub issue.
See Collect WSL logs (recommended method).
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
For anyone landing on this from a region where Docker Hub is blocked: the workaround in the description works today on wslc 2.9.4.0, and I'd echo both options.
Option 1 — pull directly from a mirror host (no settings.yaml option exists yet):
wslc pull docker.m.daocloud.io/library/alpine:latest
The image pulls from the mirror and runs identically. You just spell out the mirror host in the reference.
Option 2 — Docker → wslc transfer (good for one-off images you already have):
docker save alpine:latest -o alpine.tar
wslc load -i alpine.tar
This sidesteps the registry entirely — works even when every registry is unreachable, since it's a local file transfer.
I've also confirmed there is no registryMirrors key in settings.yaml on 2.9.4.0 (the settings file only carries session CPU/memory options), so a mirror redirect would indeed need new plumbing like the ImageService.cpp change you outlined. I keep a write-up of the current workarounds and the status of this request at https://wslcontainers.com/guides/registry-proxy/ and will update it when/if Microsoft lands mirror support.
Even outside mainland China, Docker Hub’s rate limits for unauthenticated users are strict, so without a mirror (e.g., mirror.gcr.io), WSLC isn’t really usable in practice, especially in organizations. This feature is more important than it may appear.