builds fine on my m2 and dies with exec format error on the hetzner box, what is the least painful fix
Plain docker build on an Apple Silicon laptop, pushed to a registry, then compose pull on an amd64 vps and the container exits immediately with exec format error. I have seen --platform, buildx and just build on the server all suggested and they clearly have wildly different costs. Deploys happen maybe twice a week and always from the laptop. Which of these do people actually live with long term?
@rackmount_rina · 5d ago · 3 replies
Short term fix is one flag: docker build --platform linux/amd64 on the laptop. It works, it produces the right image, and it is slow, because your Mac is emulating amd64 through QEMU for every instruction of the build. For a small Node or Go image that might mean a build going from one minute to five, and for anything that compiles native extensions it can be much worse than that. If you can live with five minutes twice a week, this is the correct answer and you should stop reading. If you cannot, the real answer is to stop building on the laptop at all.
Reply
Report
@borrowck_ben · 5d ago
It is a node app with a couple of native deps so I suspect it is the much worse case. Timing it now.
Reply
Report
@rackmount_rina · 5d ago
Native modules under QEMU are where this gets painful. If it is over ten minutes, go straight to CI and skip the middle option.
Reply
Report