Skip to content

As a Developer I want to be able to build Windows Containers with BuildKit #34

Open

Description

The windows BuildKit is only supported on Linux

image

Activity

  1. added
    triage
    on Jul 1, 2020
  2. added
    developer
    and removed
    triage
    on Jul 1, 2020
  3. jsturtevant commented on Jul 2, 2020

    @jsturtevant

    It is possible to use buildx (which uses buildkit) if there are no RUN commands in the docker file:

    docker buildx create --name img-builder --use
    docker buildx build --no-cache --pull --push \
      --platform "windows/amd64" -t $imagetag -f $dockerfile .
    docker buildx rm img-builder
    ARG nanoserverTag="mcr.microsoft.com/windows/nanoserver:1809-amd64"
    # othertags list: curl -L https://mcr.microsoft.com/v2/windows/nanoserver/tags/list
    
    FROM ${nanoserverTag}
    COPY some.exe "/Windows/System32/some.exe"

    It would be interesting to see if could use some windows emulator connected to Binfmt_misc as QEMU is used for other architectures

  4. jorgearteiro commented on Jul 7, 2020

    @jorgearteiro

    There is an issue logged on BuildKit repo moby/buildkit#616

  5. TBBle commented on Jul 8, 2020

    @TBBle

    James Sturtevant (@jsturtevant) If you wanted to go down that path, I believe Wine can be used with binfmt_misc, although I'm not sure how well that would work with namespaces since there's a WineServer and configuration directory to create, and you probably don't want that in the final image...

    It would be easier to prototype that on a raw Linux box than via the Linux support in Docker on Windows, I think.

  6. TBBle commented on Sep 17, 2020

    @TBBle

    Current status of my work on moby/buildkit#616 is that it's stalled waiting on a pile of 4 containerd PRs to be reviewed and advanced. The top of the stack is containerd/containerd#4419, but there's some outstanding design questions on the top two PRs regarding HCS behaviours, see microsoft/hcsshim#853, but the bottom two are just pending containerd maintainer review to merge or rework as appropriate.

    And after that, will come fixing path-related issues in the BuildKit LLB layer, for which I'd only scratched the surface of in moby/buildkit#1621, exploring the solution space, and which needs to be reworked per maintainer feedback.

  7. TBBle commented on Oct 20, 2020

    @TBBle

    Status unchanged, still waiting on merging or feedback on containerd support for Windows container creation/export/mount support, and then continuing the work on BuildKit itself, starting from moby/buildkit#1621

  8. immuzz commented on Oct 22, 2020

    @immuzz

    Kevin Parsons (@kevpar) Do you have any information on the containerd PRs mentioned above?

  9. TBBle commented on Dec 22, 2020

    @TBBle

    Still working through containerd PRs per above. One of four has landed, and one needs to be rewritten or at least iterated upon further. I've also opened PR on hcsshim again to remove some duplication of code with the containerd PRs.

    That said, Docker is looking at supporting containerd on Windows for 21.x (moby/moby#41455), which might mean we get BuildKit on Docker+containerd even without that containerd PR stack, as the parts I was trying to implement in containerd (WCOW layer management) are provided by Docker when Docker uses containerd, as far as I know.

    I haven't looked closely at how BuildKit integrates with Docker though, it's possible it'll still need fixes in containerd, and either way, BuildKit itself has higher-level issues to be resolved, e.g., moby/buildkit#1621.

  10. 178 remaining items

  11. gorban commented on Dec 15, 2025

    @gorban

    While we're still waiting for the official updates, I was able to get docker buildx build working, and with networking support too (docker buildx create --driver=remote npipe:////./pipe/buildkitd)! Thanks to the great work by Marat Radchenko (@slonopotamus) and Anthony Nandaa (@profnandaa)

    1. Use the stevedore project
    2. I adapted part of Anthony's gist:
      Set-Content C:\ProgramData\Docker\config\daemon.json @"
      {
        "features": {
          "containerd-snapshotter": true
        }
      }
      "@
  12. inistor commented on Jan 18, 2026

    @inistor

    I also succeeded running BuildX with WCOW, based on the instructions from profnandaa's gist ( https://gist.github.com/profnandaa/9ad40dbd90ebad99896ee0fed2916406), and relying on the fact that managed containerd is now working with Docker Engine as well (not only Docker Desktop) - so no need to register the containerd service, created a configuration for it, start it, etc.

    In short, Windows 11 25H2, Docker Engine 29.1.4, downloaded containerd 2.0.7 binaries in the same location where the Docker Engine binaries are, added:

      "default-runtime": "io.containerd.runhcs.v1",
      "features": {
        "containerd-snapshotter": true
      }
    

    to the docker configuration, downloaded the buildx plugin executable in C:\ProgramData\Docker\cli-plugins and restarted the docker service.

    Just to point out that trying newer containerd versions (2.1.x, 2.2.x) failed; docker buildx build continues to work fine, but docker run fails:

    docker: Error response from daemon: failed to create task for container: failed to create shim task: ttrpc: closed
    

    Also, an interesting fact is that docker build run explicitly, also fails (I assumed if $DOCKER_BUILDKIT=1, docker build becomes an alias for docker buildx build - but maybe I got this wrong).

    Thanks for all the hard work on WCOW! 🤞

  13. microsoft-github-policy-service commented on Feb 17, 2026

    @microsoft-github-policy-service
    Contributor

    This issue has been open for 30 days with no updates.
    Dawei Wei (@rzlink), bob sira (@bobsira), please provide an update or close this issue.

  14. microsoft-github-policy-service commented on Mar 22, 2026

    @microsoft-github-policy-service
    Contributor

    This issue has been open for 30 days with no updates.
    Dawei Wei (@rzlink), bob sira (@bobsira), please provide an update or close this issue.

  15. microsoft-github-policy-service commented on Apr 23, 2026

    @microsoft-github-policy-service
    Contributor

    This issue has been open for 30 days with no updates.
    Dawei Wei (@rzlink), bob sira (@bobsira), please provide an update or close this issue.

  16. microsoft-github-policy-service commented on May 25, 2026

    @microsoft-github-policy-service
    Contributor

    This issue has been open for 30 days with no updates.
    Dawei Wei (@rzlink), bob sira (@bobsira), please provide an update or close this issue.

  17. slonopotamus commented on Jun 21, 2026

    @slonopotamus

    How do we expand VHD size beyond 20GB when using containerd snapshotter on Windows? It seems like storage-opts is ignored in daemon.json by docker build when containerd snapshotter is enabled.

    UPD: According to moby/moby#49906 and microsoft/hcsshim#2541, there is no way currently.

    UPD2: Reported as moby/moby#53030

    UPD3: Suggested a PR: containerd/containerd#13743

  18. inistor commented on Jul 13, 2026

    @inistor

    Status update: BuildKit on WCOW is working end-to-end for us in production CI (Windows 11 25H2 / build 26200), via Docker's containerd image store.

    Following up on my earlier note about the containerd shim regression — that's now resolved, and the whole path is working. Summary in case it helps others landing here:

    What works

    • Plain docker build with a machine-wide DOCKER_BUILDKIT=1 routes through the BuildKit embedded in Docker Engine 29 — no docker buildx build rewrite needed in consuming repos.
    • Requires the containerd image store: daemon.json needs both "default-runtime": "io.containerd.runhcs.v1" and "features": { "containerd-snapshotter": true } (on the Windows static daemon the first is mandatory or dockerd refuses to start).
    • containerd is dockerd-managed (containerd.exe + containerd-shim-runhcs-v1.exe next to dockerd.exe) plus the docker-buildx CLI plugin.

    Gotchas worth flagging

    • containerd shim version: the ttrpc: closed / nil-deref regression in containerd-shim-runhcs-v1.exe affects 2.1.x, 2.2.0–2.2.2, and 2.3.0. Use 2.3.1 (or ≥ 2.2.3; 2.0.7 also predates it). Skip 2.3.0.
    • Strict os.version matching in the containerd image store: it rejects manifests whose os.version doesn't match down-level (the classic windowsfilter store was lenient). On 25H2 (10.0.26200) this broke tools pinned to older helper images (e.g. …servercore21H2 = 10.0.20348) with no matching manifest for windows(10.0.26200); pinning to the newest published servercore24H2 (10.0.26100) fixes it.
    • BuildKit rejects --memory=… on Windows (no support for Linux resource limits on Windows); --isolation=hyperv is ignored under BuildKit (real only on the classic builder).
    • Perf caveat: BuildKit's layer export + unpack is slow on WCOW — full-rebuild pipelines can be slower than the classic builder until --mount=type=cache / registry build-cache are wired.

    Storage angle (CimFS) for anyone chasing the "images larger than actual size" problem: containerd already ships a working CimFS snapshotter and differ, and on 25H2 (26200) they work end-to-end via ctr (pull → unpack via the cimfs differ → run a CimFS-rooted container). It's just not wired into any default config (diff-service order + transfer unpack_config), and Docker Engine currently exposes no way to select it. Block/verified/merged CIM are still OS-gated off on all GA Windows (hcsshim gates them to build ≥ 27766/27800, currently placeholder). I'll file the dockerd-side wiring gap separately.

  19. microsoft-github-policy-service commented on Aug 12, 2026

    @microsoft-github-policy-service
    Contributor

    This issue has been open for 30 days with no updates.
    Dawei Wei (@rzlink), bob sira (@bobsira), please provide an update or close this issue.

  20. microsoft-github-policy-service commented on Sep 11, 2026

    @microsoft-github-policy-service
    Contributor

    This issue has been open for 30 days with no updates.
    Dawei Wei (@rzlink), bob sira (@bobsira), please provide an update or close this issue.

  21. microsoft-github-policy-service commented on Oct 12, 2026

    @microsoft-github-policy-service
    Contributor

    This issue has been open for 30 days with no updates.
    Dawei Wei (@rzlink), bob sira (@bobsira), please provide an update or close this issue.

  22. mloskot commented on Oct 16, 2026

    @mloskot

    Building WCOW with BuildKit, containerd and nerdctl on Windows Server 2020 works for me. I'm currently using the following versions:

    • BuildKit 0.33.1
    • containerd 2.4.1
    • WinCNI 0.3.3
    • nerdctl 2.4.1

    Perhaps this old issue should now be closed to avoid confusions, then move into phase of submitting specific issues.

  23. inistor commented on Oct 16, 2026

    @inistor

    Indeed, it is working, I'm also running it, in production, for automated bulds. I was chasing CimFS as snapshotter, in the hope that it's faster, but it's true that the point of this issue was to use BuildKit on Windows for building images - and this is fully possible.

  24. linghengqian commented on Oct 16, 2026

    @linghengqian
  25. microsoft-github-policy-service commented on Nov 16, 2026

    @microsoft-github-policy-service
    Contributor

    This issue has been open for 30 days with no updates.
    Dawei Wei (@rzlink), bob sira (@bobsira), please provide an update or close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

buildkitdeveloper

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions