Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use buildx on docker desktop windows mode? #176

Closed
scyto opened this issue Oct 23, 2019 · 5 comments
Closed

Is it possible to use buildx on docker desktop windows mode? #176

scyto opened this issue Oct 23, 2019 · 5 comments

Comments

@scyto
Copy link

scyto commented Oct 23, 2019

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

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?

@scyto
Copy link
Author

scyto commented Oct 23, 2019

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)

@AkihiroSuda
Copy link
Collaborator

BuildKit doesn't support windows.
Contribution wanted.

@scyto
Copy link
Author

scyto commented Oct 24, 2019

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.

@scyto
Copy link
Author

scyto commented Sep 22, 2020

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

@scyto scyto closed this as completed Sep 22, 2020
@devedse
Copy link

devedse commented Apr 6, 2021

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.

gesellix added a commit to docker-client/echo-server that referenced this issue Jul 31, 2022
Windows containers require a special treatment due to buildx not being compatible, yet.

Relates to docker/buildx#176
Relates to docker/build-push-action#18
gesellix added a commit to docker-client/echo-server that referenced this issue Jul 31, 2022
Windows containers require a special treatment due to buildx not being compatible, yet.

Relates to docker/buildx#176
Relates to docker/build-push-action#18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants