You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PS D:\Test> nerdctl build -t iis-server .
time="2024-04-30T17:10:39+03:00" level=fatal msg="no image was built"
PS D:\Test> error: failed to solve: failed to copy to tar: rpc error: code = Unknown desc = write /dev/stdout: The pipe is being closed.
Steps to reproduce the issue
Describe the results you received and expected
I'm trying to build iis server image on windows containers, and this is the error I recieve.
I'm also very new to containers and the whole conception about them and have no idea how to procced from here
What version of containerd are you using?
latest
Any other relevant information
No response
Show configuration if it is related to CRI plugin.
@iankingori Traced the problem to the I/O reader returned by StdoutPipe() in nerdctl build.goL78C11. Need to do further investigation if this is a nerdctl issue or a buildkit issue.
It was working in November 2023, but this problem appeared between then and February 2024, per #2587. I don't know if something changed in nerdctl that affected this, or if there was a change in buildkitd. Or maybe both, see the end of #2587 (comment)
But that should help give you somewhere to bisect with (although you'd need to backport the PR if you wanted to test nerdctl before that PR was merged. But you could rule old buildkit in or out easily enough.)
So try redirecting buildctl's stdout and stderr to separate files, which should emulate what nerdctl is doing. If that works, then buildctl is fine and the problem does lie in nerdctl's setup. (Based on the initial error, nerdctl closed the fd connected to buildkit's stdout too early? Weird that --progress=plain affects that though. I haven't actually checked the code though, so maybe that's not weird for current implementation reasons.)
error: failed to solve: failed to get reader: content digest sha256:4a74766ac776b275376a07d5357fd928f8b871c9e3d409729ed7e1ff0c1e608c: not found
That second case's failure looks like a bug in buildkit; a quick check shows that digest is the Windows nanoserver 10.0.20348.2762 base image, so it should be in the content store already. Might be worth raising as an issue in the buildkit project, and if possible, confirming whether we have the same problem on Linux. (I assume it's not fixed by --progress=plain)
This last one might be an issue with exporting "foreign"/"non-distributable" layers; that layer is not marked non-distributable anymore, but I recall there was a bug in buildkit or containerd where the "foreign"/"non-distibutable" flags were being conflated with the presence of URLs where the layer could be fetched by HTTP, and I suspect the Windows base images still have the URL metadata even though the layers are no longer flagged foreign/non-distributable... moby/buildkit#2561 (comment) is what I'm thinking of, and it looks like this conflation still exists. I didn't break that comment out into a separate bug report at the time, sadly. (There might also be an issue somewhere else in either buildkit or containerd that this issue is triggering; but we'd have to track that down via buildkit first anyway.)
Anyway, see if adding prefer-nondist-layers=true to the output options fixes that last one, or has any effect at all, even.
Test 1 in #3629 (comment)also shows things working correctly on Windows. However, to test the failure case under nerctl build, stdout and stderr should be redirected to a file.
error: failed to solve: failed to get reader: content digest sha256:4a74766ac776b275376a07d5357fd928f8b871c9e3d409729ed7e1ff0c1e608c: not found
is very likely related to #4121 and generally the use of imagestore.Delete.
Actual bug might still be in buildkitd though, which possibly uses a similar convert function that mistakenly delete the final ref (which in turn does GC some layer), before saving the final image.
When I'll be done here with our own issues, will have a look at buildkit convert code.
Activity
slonopotamus commentedon Jul 11, 2024
I am observing the same behavior using the trivial
Dockerfile:My environment:
iankingori commentedon Jul 11, 2024
@slonopotamus try running this with
--progress=plainflag. There's a known issue with tty progress. See: #2587 (comment)slonopotamus commentedon Jul 11, 2024
🎉 It works with
--progress=plain, thanks for the workaround!TinaMor commentedon Oct 28, 2024
@iankingori Traced the problem to the I/O reader returned by StdoutPipe() in nerdctl build.goL78C11. Need to do further investigation if this is a nerdctl issue or a buildkit issue.
TBBle commentedon Oct 28, 2024
It was working in November 2023, but this problem appeared between then and February 2024, per #2587. I don't know if something changed in nerdctl that affected this, or if there was a change in buildkitd. Or maybe both, see the end of #2587 (comment)
But that should help give you somewhere to bisect with (although you'd need to backport the PR if you wanted to test nerdctl before that PR was merged. But you could rule old buildkit in or out easily enough.)
TinaMor commentedon Nov 6, 2024
cc @profnandaa
Following the buildctl documentation on using output, I run the buildctl commands for each.
> buildctl --version buildctl github.com/moby/buildkit v0.17.0 fd61877fa73693dcd4ef64c538f894ec216409a3Docker tarball
Using nerdctl:
OCI tarball
containerd image store
TBBle commentedon Nov 6, 2024
If I understand the last post correctly, the first case is the one that is happening underneath the failing
nerdctl buildcommand, is that right?This error comes from buildctl, but only happens if buildctl is directly connected to a terminal, and I expect the same failure on Linux, or with
--progress=plain.So try redirecting buildctl's stdout and stderr to separate files, which should emulate what nerdctl is doing. If that works, then buildctl is fine and the problem does lie in nerdctl's setup. (Based on the initial error, nerdctl closed the fd connected to buildkit's stdout too early? Weird that
--progress=plainaffects that though. I haven't actually checked the code though, so maybe that's not weird for current implementation reasons.)That second case's failure looks like a bug in buildkit; a quick check shows that digest is the Windows nanoserver 10.0.20348.2762 base image, so it should be in the content store already. Might be worth raising as an issue in the buildkit project, and if possible, confirming whether we have the same problem on Linux. (I assume it's not fixed by
--progress=plain)This last one might be an issue with exporting "foreign"/"non-distributable" layers; that layer is not marked non-distributable anymore, but I recall there was a bug in buildkit or containerd where the "foreign"/"non-distibutable" flags were being conflated with the presence of URLs where the layer could be fetched by HTTP, and I suspect the Windows base images still have the URL metadata even though the layers are no longer flagged foreign/non-distributable... moby/buildkit#2561 (comment) is what I'm thinking of, and it looks like this conflation still exists. I didn't break that comment out into a separate bug report at the time, sadly. (There might also be an issue somewhere else in either buildkit or containerd that this issue is triggering; but we'd have to track that down via buildkit first anyway.)
Anyway, see if adding
prefer-nondist-layers=trueto the output options fixes that last one, or has any effect at all, even.TinaMor commentedon Nov 13, 2024
@TBBle Everything works fine on Linux. The problem is with Windows using PowerShell/ cmd.
TBBle commentedon Nov 14, 2024
Test 1 in #3629 (comment) also shows things working correctly on Windows. However, to test the failure case under
nerctl build, stdout and stderr should be redirected to a file.TinaMor commentedon Nov 15, 2024
Seems like a buildkit issue. Filing a bug in buildkit
TBBle commentedon Nov 15, 2024
The bug's actually in https://github.com/containerd/console: containerd/console#83
apostasie commentedon Apr 18, 2025
That part:
is very likely related to #4121 and generally the use of
imagestore.Delete.Actual bug might still be in buildkitd though, which possibly uses a similar
convertfunction that mistakenly delete the final ref (which in turn does GC some layer), before saving the final image.When I'll be done here with our own issues, will have a look at buildkit convert code.
slonopotamus commentedon Jun 29, 2026
containerd/console#83 was fixed.
mloskot commentedon Jul 17, 2026
@slonopotamus
Golden, thank you! I'm setting up containerd + buildkit on Windows Server 2022 for the first time and it took me hours of hopeless troubleshooting...
It was, but the fix has not made it down the tool chain yet, so users still need the
--progress=plain