Repository navigation
Description
Windows Version
Microsoft Windows [版本 10.0.26300.9711]
WSL Version
3.0.3.0
Are you using WSL 1, WSL 2, or WSLC?
- WSL 2
- WSL 1
- WSLC
Kernel Version
Linux version 6.18.54.1-microsoft-standard-WSL2-gd504d40ab838 (root@FengComputer) (clang version 23.1.1, LLD 23.1.1) #1 SMP PREEMPT_DYNAMIC Fri Oct 9 01:08:40 CST 2026
Distro Version
No response
Other Software
PowerShell 7.6.7(Win x64)
Python 3.14.7 (tags/v3.14.7:823f032, Aug 5 2026, 10:51:32) [MSC v.1944 64 bit (AMD64)] on win32
Repro Steps
Create a folder and put the following files in it: default-session-test.ps1, Dockerfile, image.tar (generated with wslc export ubuntu:latest -o image.tar), script-session-test.ps1, server.py, and test_connection.sh. Also create a .wslc.session folder.
Files
default-session-test.ps1
Write-Host "--------------------------------------------------------"
&wslc image load -i .\image.tar
Write-Host "--------------------------------------------------------"
&wslc build "--progress=plain" "--no-cache" . "-t" "docker.io/test/test:0.0.1"
Write-Host "--------------------------------------------------------"
&wslc run --rm -it "docker.io/test/test:0.0.1"
Write-Host "--------------------------------------------------------"Dockerfile
FROM ubuntu:latest
RUN apt-get update && apt-get -y install \
curl dnsutils iptables tcpdump\
&& rm -rf /var/lib/apt/lists/*
COPY test_connection.sh /test_connection.sh
RUN chmod +x "/test_connection.sh"
RUN "/bin/bash" "/test_connection.sh"
ENTRYPOINT ["/bin/bash", "/test_connection.sh"]script-session-test.ps1
if(!($IsWindows -or ($env:OS -eq 'Windows_NT'))){
Write-Error "This script is only supported on Windows."
exit 1
}
if(! [System.Environment]::Is64BitOperatingSystem) {
Write-Error "This script is only supported on 64-bit Windows."
exit 2
}
if ([Environment]::Version.Major -lt 9) {
Write-Error "required higher PowerShell version (TFM NET 9+)"
exit 3
}
function Expand-Nupkg([string]$id, [string]$version) {
$zip = Join-Path $env:TEMP "$id.$version.nupkg"
$out = Join-Path $env:TEMP "$id.$version.d"
if (![System.IO.Directory]::Exists($out)) {
if (![System.IO.File]::Exists($zip)) {
Write-Host "DownLoading $id@$version ..."
Invoke-WebRequest -UseBasicParsing `
-Uri "https://www.nuget.org/api/v2/package/$id/$version" -OutFile $zip
}
[IO.Compression.ZipFile]::ExtractToDirectory($zip, $out)
}
return $out
}
if (-not ('Microsoft.WSL.Containers.WslcService' -as [type])) {
Add-Type -AssemblyName System.IO.Compression.FileSystem
$arch=$null
switch ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)
{
([System.Runtime.InteropServices.Architecture]::X64) { $arch="win-x64" }
([System.Runtime.InteropServices.Architecture]::Arm64) { $arch="win-arm64"}
default {
Write-Error "Unsupported process architecture: $PSItem"
exit 4
}
}
$wslc = Expand-Nupkg "Microsoft.WSL.Containers" "3.0.3"
$winSdk = Expand-Nupkg "Microsoft.Windows.SDK.NET.Ref" "10.0.28000.87"
$wslcCsDll=[System.IO.Path]::Combine(([System.IO.Directory]::EnumerateDirectories([System.IO.Path]::Combine($wslc,"lib"))| Select-Object -First 1),"wslcsdkcs.dll")
$wslcCDll=[System.IO.Path]::Combine(([System.IO.Directory]::EnumerateDirectories([System.IO.Path]::Combine($wslc,"lib"))| Select-Object -First 1),"wslcsdk.dll")
$csWinRTDll=[System.IO.Path]::Combine(([System.IO.Directory]::EnumerateDirectories([System.IO.Path]::Combine($winSdk,"lib"))| Select-Object -First 1),"WinRT.Runtime.dll")
$winSdkDll=[System.IO.Path]::Combine(([System.IO.Directory]::EnumerateDirectories([System.IO.Path]::Combine($winSdk,"lib"))| Select-Object -First 1),"Microsoft.Windows.SDK.NET.dll")
if(![System.IO.File]::Exists($wslcCDll)){
Copy-Item -Path ([System.IO.Path]::Combine($wslc,"runtimes",$arch,"native","wslcsdk.dll")) -Destination $wslcCDll
}
Add-Type -Path $csWinRTDll
Add-Type -Path $winSdkDll
Add-Type -Path $wslcCsDll
}
$missingComponents = [Microsoft.WSL.Containers.WslcService]::GetMissingComponents()
foreach ($component in $missingComponents) {
if($component == ([Microsoft.WSL.Containers.Component]::SdkNeedsUpdate))
{
Write-Error "This application is incompatible with the installed WSL runtime,Please update WSL"
exit 5
}
}
if(!($missingComponents.Count -eq 0))
{
Write-Error "WSL components are missing. Run: wsl --install"
exit 6
}
$wslcVersion = [Microsoft.WSL.Containers.WslcService]::GetVersion()
Write-Host ([System.String]::Format("Running on Windows Subsystem of Linux v{0}.{1}.{2}",@($wslcVersion.Major,$wslcVersion.Minor,$wslcVersion.Revision)))
$wslcCessionPath=[System.IO.Path]::Combine($PSScriptRoot,".wslc.session")
$wslcSessionSettings=[Microsoft.WSL.Containers.SessionSettings]::new("TheColdWorld.QwenImageRunner",$wslcCessionPath);
$wslcSessionSettings.CpuCount=([System.Environment]::ProcessorCount)
$wslcSessionSettings.MemorySizeInMB=( [math]::Round((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1MB, 2) /2)
$wslcSessionSettings.Timeout=[System.TimeSpan]::new(0,1,0,0,0)
$wslcSessionSettings.EnableGpu=$true
$wslcSessionSettings.VhdRequirements=[Microsoft.WSL.Containers.VhdOptions]::new("TheColdWorld.QwenImageRunner",128*1024*1024*1024,([Microsoft.WSL.Containers.VhdType]::Dynamic))
#$wslcSessionSettings.VhdRequirements.Owner=[Microsoft.WSL.Containers.VhdOwner]::new(1000,1000)
$wslcSession = [Microsoft.WSL.Containers.Session]::new($wslcSessionSettings)
try {
$wslcSession.Start()
}
catch {
Write-Error $_.Exception
Write-Error $_.Exception.InnerException
exit 7
}
Write-Host "Successfully created wslcSession in $wslcCessionPath"
try {
Write-Host "--------------------------------------------------------"
&wslc "--session" $wslcSessionSettings.Name image load -i .\image.tar
Write-Host "--------------------------------------------------------"
&wslc "--session" $wslcSessionSettings.Name build "--progress=plain" "--no-cache" . "-t" "docker.io/test/test:0.0.1"
Write-Host "--------------------------------------------------------"
&wslc "--session" $wslcSessionSettings.Name run --rm -it "docker.io/test/test:0.0.1"
Write-Host "--------------------------------------------------------"
}
finally {
$wslcSession.Terminate()
$wslcSession.Dispose()
}server.py
from http.server import BaseHTTPRequestHandler, HTTPServer
class H(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-Type', 'text/plain')
self.end_headers()
self.wfile.write(b'if you see this means the connection is well')
HTTPServer(('', 32764), H).serve_forever()test_connection.sh
#!/usr/bin/env bash
echo "--------------nskookup---------------"
nslookup host.wslc.internal || true
echo "----------------curl-----------------"
curl -v http://host.wslc.internal:32764 || trueStart the server with python server.py (this is used by test_connection.sh to test HTTP connectivity).
In two separate PowerShell processes, run the default-session-test.ps1 and script-session-test.ps1 scripts respectively (with the working directory / pwd set to the folder containing the Dockerfile; this process requires internet access).
Compare the outputs of the two pwsh processes.
After scripts runned,invoke &wslc system session enter .\.wslc.session\-> &wslc --session <session id generated in the previous command> image load -i .\image.tar -> &wslc --session <session id generated in the previous command> build "--progress=plain" "--no-cache" . "-t" "docker.io/test/test:0.0.1" -> &wslc --session <session id generated in the previous command> run --rm -it "docker.io/test/test:0.0.1"
Compare the outputs of this to that running with default-session-test.ps1
Expected Behavior
[5/5] RUN "/bin/bash" "/test_connection.sh"
| --------------nskookup---------------
| Server: 192.168.1.1
| Address: 192.168.1.1#53
|
| Name: host.wslc.internal
| Address: 169.254.73.254
| ** server can't find host.wslc.internal: NXDOMAIN
|
| ----------------curl-----------------
| % Total % Received % Xferd Average Speed Time Time Time Current
| Dload Upload Total Spent Left Speed
| 0 0 0 0 0 0 0 0 0* Host host.wslc.internal:32764 was resolved.
| * IPv6: (none)
| * IPv4: 169.254.73.254
| * Trying 169.254.73.254:32764...
| * Established connection to host.wslc.internal (169.254.73.254 port 32764) from 172.17.0.2 port 60478
| * using HTTP/1.x
| > GET / HTTP/1.1
| > Host: host.wslc.internal:32764
| > User-Agent: curl/8.18.0
| > Accept: */*
| >
| * Request completely sent off
| * HTTP 1.0, assume close after body
| < HTTP/1.0 200 OK
| < Server: BaseHTTP/0.6 Python/3.14.7
| < Date: Wed, 21 Oct 2026 14:03:26 GMT
| < Content-Type: text/plain
| <
| { [44 bytes data]
| 100 44 0 44 0 0 1106 0 0
| * shutting down connection #0
| if you see this means the connection is well
Full Output: default-session-test.ps1.log
Actual Behavior
[5/5] RUN "/bin/bash" "/test_connection.sh"
| --------------nskookup---------------
| Server: 192.168.1.1
| Address: 192.168.1.1#53
|
| ** server can't find host.wslc.internal: NXDOMAIN
|
| ----------------curl-----------------
| % Total % Received % Xferd Average Speed Time Time Time Current
| Dload Upload Total Spent Left Speed
| 0 0 0 0 0 0 0 0 0* Could not resolve host: host.wslc.internal
| * Store negative name resolve for host.wslc.internal:32764
| * shutting down connection #0
| curl: (6) Could not resolve host: host.wslc.internal
Full Output: script-session-test.ps1.log
After script run:
[5/5] RUN "/bin/bash" "/test_connection.sh"
| --------------nskookup---------------
| Server: 192.168.1.1
| Address: 192.168.1.1#53
|
| Name: host.wslc.internal
| Address: 169.254.73.254
|
| ----------------curl-----------------
| % Total % Received % Xferd Average Speed Time Time Time Current
| Dload Upload Total Spent Left Speed
| 0 0 0 0 0 0 0 0 0* Host host.wslc.internal:32764 was resolved.
| * IPv6: (none)
| * IPv4: 169.254.73.254
| * Trying 169.254.73.254:32764...
| * Established connection to host.wslc.internal (169.254.73.254 port 32764) from 172.17.0.2 port 54392
| * using HTTP/1.x
| > GET / HTTP/1.1
| > Host: host.wslc.internal:32764
| > User-Agent: curl/8.18.0
| > Accept: */*
| >
| * Request completely sent off
| * HTTP 1.0, assume close after body
| < HTTP/1.0 200 OK
| < Server: BaseHTTP/0.6 Python/3.14.7
| < Date: Wed, 21 Oct 2026 14:07:14 GMT
| < Content-Type: text/plain
| <
| { [44 bytes data]
| 100 44 0 44 0 0 1454 0 0
| * shutting down connection #0
| if you see this means the connection is well
Full Output: after-script-run.log
Diagnostic Logs
No response
Activity
github-actions commentedon Oct 21, 2026
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:
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 networkinginstead, following the instructions in Collect WSL logs for networking issuesOnce 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'.
TheColdWorld commentedon Oct 21, 2026
/emailed-logs
github-actions commentedon Oct 21, 2026
Diagnostic information