WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Run `wslc` from within a WSL distro

Open craigloewen-msft opened this issue 4 months ago • 6 comments

Is your feature request related to a problem? Please describe. I want to run my wslc commands from within a WSL distro.

Describe the solution you'd like Support the wslc binary from within any WSL distro.

Describe alternatives you've considered Use wslc.exe but then file mounting is hard.

Additional context N/A

craigloewen-msft avatar Jul 17 '26 15:07 craigloewen-msft

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'.

github-actions[bot] avatar Jul 17 '26 15:07 github-actions[bot]

/feature

craigloewen-msft avatar Jul 17 '26 15:07 craigloewen-msft

Diagnostic information
Found '/feature', adding tag 'feature'

github-actions[bot] avatar Jul 17 '26 15:07 github-actions[bot]

/feature

Agree this would be valuable — the main friction right now is that wslc.exe is a Windows binary, so from inside a WSL distro you can call it via /mnt/c/Program Files/WSL/wslc.exe but file mounting becomes painful because the paths need to be Windows-side paths (e.g. C:/work:/app), not Linux paths from the distro.

A wslc binary inside the distro that understands Linux filesystem paths would make two workflows much cleaner:

  1. Shell scripts that mix wslc commands with other Linux tooling (no path translation needed)
  2. CI/CD inside a WSL distro that wants to use wslc instead of Docker (currently you have to call wslc.exe from PowerShell on the Windows side)

As a temporary bridge until a native distro binary ships, a small shell wrapper that translates Linux paths to their /mnt/c/... Windows equivalents before calling wslc.exe would cover the common cases. (For the reverse — Windows-side path conventions — the install guide at https://wslcontainers.com/guides/install/ covers the prerequisites.)

ylwl1997 avatar Aug 04 '26 03:08 ylwl1997

I’d really like to see this implemented.

In wslc-wip, I currently work around this by copying the build context to a temporary directory under /mnt/c before running wslc build.

This significantly improves build performance compared with using the build context directly from the WSL filesystem.

However, ideally, wslc-wip shouldn’t need this kind of workaround at all.

If wslc could run natively from within a WSL distro and handle WSL filesystem paths efficiently, this extra copy step could be removed.

abechan1 avatar Aug 10 '26 09:08 abechan1

The worst part about this is that there is a documentation page on the Microsoft learn website that talks about running wslc inside of a distro https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-containers#build-and-run-your-own-container-image so this induced me in error thinking that there was the wslc executable available inside of my distro

PILIX123 avatar Aug 26 '26 16:08 PILIX123