Having encountered exec format error stacktrace for two times already, I definitely want to log it 😤

First encounter

I got this error when I got a new Mac M1 from my employer. I was using colima as docker desktop replacement for Mac. While working on a feature for a service, I built container image using colima; pushed the image to container registry and tried deploying to dev environment. And saw the exec format error in logs.

After searching on the internet, I found the problem was that M1/Apple Silicon uses the linux/arm64/v8 architecture. So the image build was not for amd64 architecture based machines in the cloud. I got to know that I would need to build amd64 image using docker buildkit .

This also caused me to switch from colima to rancher desktop because of its ease of usage with moby/containerd, buildx and kubernetes support. I am a happy user of rancher desktop and would highly recommend it for Macs using M1/Apple Silicon or for replacing docker desktop.

Second Time

This was quite recent when I found out that the already existing dockerfile didn’t work so great because someone forgot to add shebang in the entrypoint.sh script for a docker file

1
2
3
#!/usr/bin/env bash
java $JAVA_OPTS \
  -cp /app org.springframework.boot.loader.JarLauncher

#!/bin/bash would have worked as well.