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
docker backend doesn't use buildx for multi-platform #19994
Comments
@mark-thm Have you tried the following?
[docker]
env_vars = [
"DOCKER_BUILDKIT",
] |
Sorry for the delay, just gave that whirl, and docker produces the following stderr output:
|
According to the docs BuildKit is default as of Docker 23.0 and I'm Docker 24.0, so I think this has no effect. |
Try this (e.g.) also and I think that should get you going for now: Create a builder using a build driver that is compatible with the cache backend:
Use the builder:
And also add the I came across this as part of this PR. |
aha, magic. Thanks. I had to drop the final |
It seems to me like this level of setup shouldn't be required/I'll have to figure out how to engineer the same set of state onto my CI system vs. just running |
Which CI system are you using? I was just looking into the same for Github Actions recently and it looks straightforward, but not sure about others. |
+1 for this issue. Although, I'm having the same error even when pre-creating a builder with I'm on macOS 13 Apple Silicon. |
@kaos Is there any way to future-pick this feature for an earlier release? |
@danny-todd-oxb It'll be in the 2.19.0 release which has entered stabilization. I don't think it'll come out much sooner if we were to pick it further back, so only reason for us to consider that would be if there are something else blocking you from using the upcoming 2.19 release I think.. |
I am trying to use docker driver docker buildx create --name container --driver=docker-container --use --bootstrap
export BUILDX_BUILDER=container # I have set `docker.env_vars=["BUILDX_BUILDER"]` in pants.toml
pants publish my-target with docker_image(
name="my-target",
repository="my-repo",
image_tags=["a-tag"],
build_platform=["linux/amd64","linux/arm64"],
) Pants is successfully able to use docker and generate multi-platform images, however it's unable to push, because it's missing the
After build is finished, pants tries to push the image manually, however it fails because the image is present in I think this can be solved by allowing pants Any plans to add support for something like this? |
@rajeshwar-nu Yes, this is coming in 2.19 as part of #20154 as mentiond above |
Sounds Amazing! any ideas when that is coming out? |
This kinda works now, you can specify the buildx output like this, which causes the image to get pushed to the registry
But it does so under |
Describe the bug
Docker backend runs
docker build
rather thandocker buildx build
for multi-platform builds specified withbuild_platform
set to a list. Single valued lists forbuild_platform
will build correctly, but fail to produce a multi-architecture output image.Pants version
2.18.0a0 (verified bug still present on mainline, source linked below)
OS
MacOS
Additional info
Docker version 24.0.6, build ed223bc
Using
docker build
vsdocker buildx build
:pants/src/python/pants/backend/docker/util_rules/docker_binary.py
Line 67 in 78111bb
Experimenting with
docker build
directly:The text was updated successfully, but these errors were encountered: