Docker BuildX support Currently, when I build an ...
# general
b
Docker BuildX support Currently, when I build an AWS Lambda container compatible with AWS Graviton (arm64) it works fine on my laptop but GitHub Actions doesn't seem to support building arm64 images natively. A few people on blogs & forums seem to suggest that the workaround is to use the docker buildx action to build images, but that's incompatible with using
pulumi-docker
as a build system for the containers. Are there plans to support buildx in
pulumi-docker
? 🙏 @orange-policeman-59119 @shy-arm-32391 Also, if anybody has feedback struggling with arm images with their CI I'm happy to discuss it in this thread 🙂
s
It's supported in v4.
b
How so ? I thought the only
builderVersion
options where "BuilderBuildKit" and "BuilderV1" (vanilla docker)
o
BuilderBuildKit and BuildX share a common foundation, though it looks like more improvements are coming down the line for that functionality. You may need to install binfmt emulators to make cross platform builds work: https://github.com/tonistiigi/binfmt#installing-emulators
s
You can also explicitly specify the platform in the FROM directive in the Dockerfile if an image is only designed to be built for a single platform. https://docs.docker.com/engine/reference/builder/#from
o
But we do support setting the
platform
field to another architecture, just as Docker supports.
s
(Getting a single image to work with both arm and amd can be tricky, depending on what you're installing.)
b
I get what you're saying Josh but my based image was 100% arm64 and I did specify the
platform
argument to linux/arm64
o
Yes, unfortunately Docker does not yet have a multi-architecture API that is high level. We're waiting for improvements in Buildkit/BuildX.
@bright-orange-69401 I can guarantee that the platform field works, but you may have to install the binfmt emulators. This is also required if you're using BuildX. The difference between your laptop and GitHub Actions is that I believe Docker for Mac and Docker for Windows may install the QEMU emulators for you.
b
The error I'm getting in GitHub Actions is:
Copy code
exec /bin/sh: exec format error
With little more than that in terms of logging... but it does sounds to me like an arch mismatch somewhere
Oh ! So if I use this action beforehand: https://github.com/docker/setup-qemu-action ...then maybe my
pulumi up
will work in GHA, right ?
o
Perhaps, I'm only familiar with the
binfmt
install method. If you find that works, please let us know so we can update documentation!
Actually, that action looks like it uses
binfmt
so I expect it should work the same.
b
Yup was gonna say exactly that 🙂
I'll give it a try and I'll let you know the results If it does work with QEMU, maybe it would be a worthy addition to the docs somewhere, for those like me who struggle getting Pulumi & Docker to play nice with arm64