Heroku docker: Error on Mac apple silicon based processors

478 Views Asked by At

So, my local docker environment all works fine with docker hub desktop app. But when I try to deploy to heroku using

heroku container:push web -a your-app-name

It gives an error saying

unsupported: unsupported architecture arm64 ▸ Error: docker push exited with Error: 1

On researching, I found that heroku does not support building from arm64. Is there any workaround to this?

2

There are 2 best solutions below

2
Daniel Gutkin On

A workaround that I found useful was to build the image using the Docker CLI under linux/amd64 architecture, tag and push to the appropriate Heroku URL, then release using the Heroku CLI.

docker build -t app-name --platform linux/amd64 .
docker tag app-name registry.heroku.com/app-name/web
docker push registry.heroku.com/app-name/web
heroku container:release web -a app-name
0
adborroto On

You can also include the platform in your Dockerfile


FROM --platform=linux/amd64 ...

Then just a matter of push your image

$ heroku container:push app_name:latest