buildkit icon indicating copy to clipboard operation
buildkit copied to clipboard

Windows container failed to create shim task

Open Togtja opened this issue 6 months ago • 0 comments

Enviorment

> buildctl --version
buildctl github.com/moby/buildkit v0.15.1 979542e90f2cb38077c808e0867d8d2c16ed10b8
> docker buildx version
github.com/docker/buildx v0.16.1-desktop.1 8931f42a456e446f75f96d06902bbac8f1c1d3bd
> docker buildx inspect
Name:          buildkit-exp
Driver:        remote
Last Activity: 2024-08-06 10:44:02 +0000 UTC

Nodes:
Name:             buildkit-exp0
Endpoint:         npipe:////./pipe/buildkitd
Status:           running
BuildKit version: v0.15.1
Platforms:        windows/amd64
Labels:
 org.mobyproject.buildkit.worker.containerd.namespace: buildkit
 org.mobyproject.buildkit.worker.containerd.uuid:      d87fe4d7-3adb-4f82-a70a-f3c15deccfe5
 org.mobyproject.buildkit.worker.executor:             containerd
 org.mobyproject.buildkit.worker.hostname:             DESKTOP-GG52031
 org.mobyproject.buildkit.worker.network:
 org.mobyproject.buildkit.worker.selinux.enabled:      false
 org.mobyproject.buildkit.worker.snapshotter:          windows
GC Policy rule#0:
 All:           false
 Filters:       type==source.local,type==exec.cachemount,type==source.git.checkout
 Keep Duration: 48h0m0s
 Keep Bytes:    488.3MiB
GC Policy rule#1:
 All:           false
 Keep Duration: 1440h0m0s
 Keep Bytes:    91.27GiB
GC Policy rule#2:
 All:        false
 Keep Bytes: 91.27GiB
GC Policy rule#3:
 All:        true
 Keep Bytes: 91.27GiB

When trying to run a very simple docker file:

FROM mcr.microsoft.com/windows/servercore:ltsc2019


RUN echo "Hello World"

I run into the error:

> docker buildx build --builder buildkit-exp -f dockerfile .
[+] Building 1.1s (5/5) FINISHED                                                                                                                                                                                                                                    remote:buildkit-exp
 => [internal] load build definition from dockerfile                                                                                                                                                                                                                               0.0s
 => => transferring dockerfile: 117B                                                                                                                                                                                                                                               0.0s
 => [internal] load metadata for mcr.microsoft.com/windows/servercore:ltsc2019                                                                                                                                                                                                     0.3s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                    0.0s
 => CACHED [1/2] FROM mcr.microsoft.com/windows/servercore:ltsc2019@sha256:41f42aa4ad39d85e4d30642b8111ca6454ca2275f188f012934b9afbaf63a647                                                                                                                                        0.0s
 => => resolve mcr.microsoft.com/windows/servercore:ltsc2019@sha256:41f42aa4ad39d85e4d30642b8111ca6454ca2275f188f012934b9afbaf63a647                                                                                                                                               0.0s
 => ERROR [2/2] RUN echo "Hello World"                                                                                                                                                                                                                                             0.7s
------
 > [2/2] RUN echo "Hello World":
------
WARNING: No output specified with remote driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
dockerfile:4
--------------------
   2 |
   3 |
   4 | >>> RUN echo "Hello World"
   5 |
--------------------
ERROR: failed to solve: process "cmd /S /C echo \"Hello World\"" did not complete successfully: failed to create shim task: hcs::CreateComputeSystem m6ojaf50wxzk08w9fxmgxkirk: The container operating system does not match the host operating system.: unknown

View build details: docker-desktop://dashboard/build/buildkit-exp/buildkit-exp0/pvm53zkf086dsgwafmsq0untr

I get the same error if I use ltsc2022

Any tips or tricks on how to build simple Windows Container? I am able to do so using the normal docker build:

> docker build -f dockerfile .
Sending build context to Docker daemon  637.4kB
Step 1/2 : FROM mcr.microsoft.com/windows/servercore:ltsc2019
 ---> b51a50ce03f1
Step 2/2 : RUN echo "Hello World"
 ---> Running in 3c6c10e36e01
"Hello World"
 ---> Removed intermediate container 3c6c10e36e01
 ---> a0c0f7995b32
Successfully built a0c0f7995b32

Togtja avatar Aug 06 '24 10:08 Togtja