Buildx: Is it possible to use buildx on docker desktop windows mode?

Created on 24 Oct 2019  路  5Comments  路  Source: docker/buildx

I have latest windows docker desktop edge and ithub.com/docker/buildx v0.3.1-tp-docker 6db68d029599c6710a32aa7adcba8e5a344795a7

When I try and use default buildx context i get told push is not supported - this happens in both linux and windows modes. Using the procedure documented here works for linux, but if i switch to windows containers and do the same procedure (with different builder context name) it utterly messes up and generates system named pipe errors on buildx ls, only an uninstall of docker desktop and manual removal of c:%username%.docker fixes it.

This leads to believe that buildx is not yet working with windows containers - is that correct or should i submit a more detailed bug?

Most helpful comment

I came up with solution to workaround this and achieve what i want.
It does require two dockerfiles but as windows is so different i think that is ok.
This created one tag that was both linux and windows.

C:\"Program Files"\Docker\Docker\DockerCli.exe -SwitchLinuxEngine
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t scyto/nodelink:latest --push -f Dockerfile.linux .
C:\"Program Files"\Docker\Docker\DockerCli.exe -SwitchWindowsEngine
docker build  -t scyto/nodelink:windows.amd64 -f Dockerfile.windows.amd64 .
docker push scyto/nodelink:windows.amd64
C:\"Program Files"\Docker\Docker\DockerCli.exe -SwitchLinuxEngine
docker buildx imagetools create --append -t scyto/nodelink:latest scyto/nodelink:windows.amd64

All 5 comments

I got a little further like this.

  1. switch to windows container mode
  2. docker buildx create --name foo --platform windows/amd64
  3. docker buildx use foo
  4. docker buildx inspect --bootstrap
[+] Building 0.0s (1/1) FINISHED
 => ERROR [internal] booting buildkit                                                                                                                                                                        1.8s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                                                                                           1.8s
 => => creating container buildx_buildkit_foo0                                                                                                                                                               0.0s
------
 > [internal] booting buildkit:
------
Name:   foo
Driver: docker-container
  1. docker buildx build --push --platform windows/amd64 -f .Dockerfile.windows.amd64 -t scyto/nodelink:dev-latest.windows .
docker buildx build --push --platform windows/amd64 -f .\Dockerfile.windows.amd64 -t scyto/nodelink:dev-latest.windows .
[+] Building 0.0s (1/1) FINISHED
 => ERROR [internal] booting buildkit                                                                                                                                                                        1.6s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                                                                                           1.6s
 => => creating container buildx_buildkit_foo0                                                                                                                                                               0.0s
------
 > [internal] booting buildkit:
------
Error response from daemon: Windows does not support privileged mode

but i still can't build a windows image using buildx.... am i missing somethere here? Also my observation is attempting to combine windows and linux on the same builder make things very unstable (this was my earlier issues with named pipes)

BuildKit doesn't support windows.
Contribution wanted.

Should the commands be blocked when in windows container mode, maybe with meaningful error? Attempting to use can render docker desktop unusable and requiring uninstall and manual steps.

I came up with solution to workaround this and achieve what i want.
It does require two dockerfiles but as windows is so different i think that is ok.
This created one tag that was both linux and windows.

C:\"Program Files"\Docker\Docker\DockerCli.exe -SwitchLinuxEngine
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t scyto/nodelink:latest --push -f Dockerfile.linux .
C:\"Program Files"\Docker\Docker\DockerCli.exe -SwitchWindowsEngine
docker build  -t scyto/nodelink:windows.amd64 -f Dockerfile.windows.amd64 .
docker push scyto/nodelink:windows.amd64
C:\"Program Files"\Docker\Docker\DockerCli.exe -SwitchLinuxEngine
docker buildx imagetools create --append -t scyto/nodelink:latest scyto/nodelink:windows.amd64

Has the functionality improved already to more easily build an image for both windows and linux using buildx? Ideally I would like to include this with github actions.

Was this page helpful?
0 / 5 - 0 ratings