How to set platform for automated builds on docker hub

I am trying to create automated builds in docker hub from GitHub. My dockerfile is targeting a bullseye debian image for linux/arm64 use. I am using emulation on my docker desktop for windows to build these images locally.

However, trying to build them using the docker automated builds I am getting errors such as these:
[Warning] The requested image’s platform (linux/arm64) does not match the detected host platform (linux/amd64) and no specific platform was requested

[91mexec /bin/sh: exec format error

From looking around online I found that these might be related to trying to build to arm64. How do I set up docker autobuilds to properly build to my target platform of linux/arm64?

Thanks!

This is the key

You can use hooks to customize the commands used for building images, testing and pushing to the registry.

Hi there,

I’m also trying to get an automated build to work for linux/arm64v8.

I’ve tried implementing a build hook like you suggested but it fails. This is what I have so far

#!/bin/bash
docker buildx build --platform linux/arm64v8 -f $DOCKERFILE_PATH $IMAGE_NAME

Any input to what i have got wrong?

Thanks

Fails how?

If linux/arm64v8 is a valid alias then it could work, but I use linux/arm64/v8

This isn’t running on Docker Hub but pushes the images to Docker Hub.

I found the issue i was missing the --platform=$BUILDPLATFORM from my docker file and also had the hook wrong it should have been #!/bin/bash docker build --platform linux/arm64v8 -t $IMAGE_NAME .

Thanks for replying so quick!