Windows Version
Microsoft Windows [Version 10.0.26200.8893]
WSL Version
2.9.4.0
Are you using WSL 1 or WSL 2?
Kernel Version
6.18.35.2-1
Distro Version
No response
Other Software
- WSLC 2.9.4.0
- Docker Desktop, used only as a control to build the same recreated context successfully
- PowerShell on Windows
Repro Steps
-
In PowerShell, create a minimal build context:
$context = Join-Path $env:TEMP "wslc-stale-context-repro"
Remove-Item $context -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Path $context | Out-Null
@'
FROM busybox:latest
COPY marker.txt /marker.txt
RUN test -f /marker.txt
'@ | Set-Content (Join-Path $context "Dockerfile") -Encoding ascii
"first directory" | Set-Content (Join-Path $context "marker.txt") -Encoding ascii
-
Build the context:
wslc build --no-cache --tag wslc-stale-context-repro $context
The first build succeeds.
-
Delete the complete context directory and recreate it at the identical
Windows path:
Remove-Item $context -Recurse -Force
New-Item -ItemType Directory -Path $context | Out-Null
@'
FROM busybox:latest
COPY marker.txt /marker.txt
RUN test -f /marker.txt
'@ | Set-Content (Join-Path $context "Dockerfile") -Encoding ascii
"recreated directory" | Set-Content (Join-Path $context "marker.txt") -Encoding ascii
Get-ChildItem $context
Get-ChildItem shows that Dockerfile and marker.txt exist.
-
Run the same WSLC build again:
wslc build --no-cache --tag wslc-stale-context-repro $context
WSLC reports that /marker.txt is not found.
-
Build the same recreated context with Docker Desktop:
docker build --no-cache --tag docker-context-control $context
Docker builds it successfully.
-
Copy the context to a new path and build it with WSLC:
$newContext = "$context-new"
Copy-Item $context $newContext -Recurse
wslc build --no-cache --tag wslc-new-context-control $newContext
WSLC builds successfully from the new path.
-
Terminate the WSLC session and retry the original path:
wslc system session terminate
wslc build --no-cache --tag wslc-stale-context-repro $context
The original path works again.
Expected Behavior
Every wslc build invocation should read the current files from the build
context path supplied to that invocation.
After a Windows directory is deleted and recreated at the same path, WSLC
should detect that the underlying directory has changed and refresh or recreate
the context mount. COPY marker.txt /marker.txt should succeed because
marker.txt exists in the current context and is not excluded by
.dockerignore.
The result should not depend on whether the same path was used by an earlier
build in the current WSLC session. No session restart should be necessary.
Actual Behavior
The first WSLC build succeeds. After deleting the complete Windows context
directory and recreating it at the identical path, subsequent WSLC builds act as
if the recreated context does not contain marker.txt.
The failure includes:
failed to calculate checksum ... "/marker.txt": not found
Using --no-cache does not change the result.
The same recreated directory builds successfully with Docker Desktop. WSLC also
builds successfully when the files are copied to a different path. Running
wslc system session terminate makes the original path work again.
This suggests that WSLC retains a build-context mount associated with the
deleted directory object and reuses that stale mount when the same Windows path
is supplied again.
Diagnostic Logs
ERROR: failed to solve: failed to compute cache key: failed to calculate
checksum of ref a62b46cc-b843-4094-b82f-a20b93d48306:
"/marker.txt": not found
Error code: E_FAIL
Exit code: 1
Windows Version
Microsoft Windows [Version 10.0.26200.8893]
WSL Version
2.9.4.0
Are you using WSL 1 or WSL 2?
Kernel Version
6.18.35.2-1
Distro Version
No response
Other Software
Repro Steps
In PowerShell, create a minimal build context:
Build the context:
The first build succeeds.
Delete the complete context directory and recreate it at the identical
Windows path:
Get-ChildItemshows thatDockerfileandmarker.txtexist.Run the same WSLC build again:
WSLC reports that
/marker.txtis not found.Build the same recreated context with Docker Desktop:
Docker builds it successfully.
Copy the context to a new path and build it with WSLC:
WSLC builds successfully from the new path.
Terminate the WSLC session and retry the original path:
The original path works again.
Expected Behavior
Every
wslc buildinvocation should read the current files from the buildcontext path supplied to that invocation.
After a Windows directory is deleted and recreated at the same path, WSLC
should detect that the underlying directory has changed and refresh or recreate
the context mount.
COPY marker.txt /marker.txtshould succeed becausemarker.txtexists in the current context and is not excluded by.dockerignore.The result should not depend on whether the same path was used by an earlier
build in the current WSLC session. No session restart should be necessary.
Actual Behavior
The first WSLC build succeeds. After deleting the complete Windows context
directory and recreating it at the identical path, subsequent WSLC builds act as
if the recreated context does not contain
marker.txt.The failure includes:
Using
--no-cachedoes not change the result.The same recreated directory builds successfully with Docker Desktop. WSLC also
builds successfully when the files are copied to a different path. Running
wslc system session terminatemakes the original path work again.This suggests that WSLC retains a build-context mount associated with the
deleted directory object and reuses that stale mount when the same Windows path
is supplied again.
Diagnostic Logs