Skip to content

Error: no image was built #3629

Open

Description

@veselinoWiktor

Description

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.

No response

Activity

  1. slonopotamus commented on Jul 11, 2024

    @slonopotamus
    Contributor

    I am observing the same behavior using the trivial Dockerfile:

    FROM hello-world:latest
    RUN echo "hello"

    My environment:

    > nerdctl --version
    nerdctl version 2.0.0-rc.0
    
    > nerdctl info
    Client:
     Namespace:     default
     Debug Mode:    false
    
    Server:
     Server Version: v1.7.19
     Storage Driver: windows
     Logging Driver: json-file
     Cgroup Driver:
     Cgroup Version:
     Plugins:
      Log: fluentd journald json-file syslog
      Storage: windows-lcow windows
     Security Options:
     Kernel Version:
     Operating System:
     OSType: windows
     Architecture:
     CPUs: 0
     Total Memory: 0B
     Name: MSI
     ID: 8b411fec-0013-40ab-8dcf-140ae06c8ee0
    
    > buildctl debug info
    BuildKit: github.com/moby/buildkit v0.15.0-rc2 e83d79a51fb49aeb921d8a2348ae14a58701c98
    
  2. iankingori commented on Jul 11, 2024

    @iankingori

    @slonopotamus try running this with --progress=plain flag. There's a known issue with tty progress. See: #2587 (comment)

  3. slonopotamus commented on Jul 11, 2024

    @slonopotamus
    Contributor

    🎉 It works with --progress=plain, thanks for the workaround!

  4. TinaMor commented on Oct 28, 2024

    @TinaMor
    Contributor

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

  5. TBBle commented on Oct 28, 2024

    @TBBle
    Contributor

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

  6. TinaMor commented on Nov 6, 2024

    @TinaMor
    Contributor

    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 fd61877fa73693dcd4ef64c538f894ec216409a3
    # Dockerfile
    
    FROM hello-world:latest
    RUN echo "hello"
    
    1. Docker tarball

      > & "C:\Program Files\Buildkit\bin\buildctl.exe" `
          --addr=npipe:////./pipe/buildkitd `
          build `
          --progress=auto `
          --frontend=dockerfile.v0 `
          --local=context=. `
          --output=type=docker,name=docker.io/library/iis-server3:latest `
          --local=dockerfile=C:/Users/xxxxx `
          --opt=filename=Dockerfile
      
      error: invalid output option: output: output file is required for docker exporter. refusing to write to console

      Using nerdctl:

      >   _output/nerdctl --debug build --progress auto -t iis-server3 --output type=docker --file .\Dockerfile .

      Image

    2. OCI tarball

      & "C:\Program Files\Buildkit\bin\buildctl.exe" `
          --addr=npipe:////./pipe/buildkitd `
          build `
          --progress=auto `
          --frontend=dockerfile.v0 `
          --local=context=. `
          --output=type=oci,dest=C:/Users/xxxxx/AppData/Local/Temp/output.tar,name=docker.io/library/iis-server2:latest `
          --local=dockerfile=C:/Users/xxxxx `
          --opt=filename=Dockerfile
      [+] Building 2.4s (7/7) FINISHED
      => [internal] load build definition from Dockerfile                                                                                        0.0s
      => => transferring dockerfile: 78B                                                                                                         0.0s
      => [internal] load metadata for docker.io/library/hello-world:latest                                                                       2.0s
      => [auth] library/hello-world:pull token for registry-1.docker.io                                                                          0.0s
      => [internal] load .dockerignore                                                                                                           0.0s
      => => transferring context: 122B                                                                                                           0.0s
      => [1/2] FROM docker.io/library/hello-world:latest@sha256:d211f485f2dd1dee407a80973c8f129f00d54604d2c90732e8e320e5038a0348                 0.1s
      => => resolve docker.io/library/hello-world:latest@sha256:d211f485f2dd1dee407a80973c8f129f00d54604d2c90732e8e320e5038a0348                 0.1s
      => CACHED [2/2] RUN echo "hello"                                                                                                           0.0s
      => ERROR exporting to oci image format                                                                                                     0.1s
      => => exporting layers                                                                                                                     0.0s
      => => exporting manifest sha256:312b0358bbc84f03b6c40493bba15d0eea0b586cf19c901c8c8e5731e8185daf                                           0.0s
      => => exporting config sha256:0ba713f119e7b225effacd8744c7ee9601c023586f39c71cc2044c3dbf994d57                                             0.0s
      => => sending tarball                                                                                                                      0.0s
      ------
      > exporting to oci image format:
      ------
      error: failed to solve: failed to get reader: content digest sha256:4a74766ac776b275376a07d5357fd928f8b871c9e3d409729ed7e1ff0c1e608c: not found
    3. containerd image store

      & "C:\Program Files\Buildkit\bin\buildctl.exe" `
          --addr=npipe:////./pipe/buildkitd `
          build `
          --progress=auto `
          --frontend=dockerfile.v0 `
          --local=context=. `
          --output=type=image,name=docker.io/library/iis-server3:latest `
          --local=dockerfile=C:/Users/xxxxx `
          --opt=filename=Dockerfile
      [+] Building 2.3s (7/7) FINISHED
      => [internal] load build definition from Dockerfile                                                                                 0.0s
      => => transferring dockerfile: 78B                                                                                                  0.0s
      => [internal] load metadata for docker.io/library/hello-world:latest                                                                1.9s
      => [auth] library/hello-world:pull token for registry-1.docker.io                                                                   0.0s
      => [internal] load .dockerignore                                                                                                    0.0s
      => => transferring context: 122B                                                                                                    0.0s
      => [1/2] FROM docker.io/library/hello-world:latest@sha256:d211f485f2dd1dee407a80973c8f129f00d54604d2c90732e8e320e5038a0348          0.1s
      => => resolve docker.io/library/hello-world:latest@sha256:d211f485f2dd1dee407a80973c8f129f00d54604d2c90732e8e320e5038a0348          0.1s
      => CACHED [2/2] RUN echo "hello"                                                                                                    0.0s
      => exporting to image                                                                                                               0.0s
      => => exporting layers                                                                                                              0.0s
      => => exporting manifest sha256:967e0c72299274e2770111f97d1d05c9b139417e755d8464b9e336a55276b543                                    0.0s
      => => exporting config sha256:0ba713f119e7b225effacd8744c7ee9601c023586f39c71cc2044c3dbf994d57                                      0.0s
      => => naming to docker.io/library/iis-server3:latest
      
      > ctr --namespace=buildkit images ls
      
      REF                                  TYPE                                                 DIGEST                                                                  SIZE      PLATFORMS     LABELS
      docker.io/library/iis-server3:latest application/vnd.docker.distribution.manifest.v2+json sha256:967e0c72299274e2770111f97d1d05c9b139417e755d8464b9e336a55276b543 115.0 MiB windows/amd64 -
      
  7. TBBle commented on Nov 6, 2024

    @TBBle
    Contributor

    If I understand the last post correctly, the first case is the one that is happening underneath the failing nerdctl build command, is that right?

    error: invalid output option: output: output file is required for docker exporter. refusing to write to console

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

  8. TinaMor commented on Nov 13, 2024

    @TinaMor
    Contributor

    @TBBle Everything works fine on Linux. The problem is with Windows using PowerShell/ cmd.

  9. TBBle commented on Nov 14, 2024

    @TBBle
    Contributor

    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.

  10. TinaMor commented on Nov 15, 2024

    @TinaMor
    Contributor

    Seems like a buildkit issue. Filing a bug in buildkit

    Image

  11. TBBle commented on Nov 15, 2024

    @TBBle
    Contributor
  12. apostasie commented on Apr 18, 2025

    @apostasie
    Contributor

    That part:

    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.

  13. slonopotamus commented on Jun 29, 2026

    @slonopotamus
    Contributor
  14. mloskot commented on Jul 17, 2026

    @mloskot

    @slonopotamus

    🎉 It works with --progress=plain, thanks for the workaround!

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

    containerd/console#83 was fixed.

    It was, but the fix has not made it down the tool chain yet, so users still need the --progress=plain

    Image Image
    > containerd --version
    containerd github.com/containerd/containerd/v2 v2.3.3 aad11006b869517fcd3009450b6f82da282e1a9b
    > buildkitd --version
    buildkitd github.com/moby/buildkit v0.31.2 e42e1bfd389af7203238cce77b1f7dad447285e9
    > nerdctl --version
    nerdctl version 2.3.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions