exec format error
2 min readMay 1, 2024
error: exec format error
you may get this error while running a pod using a docker image.
as shown below —
k -n middleware logs -f tomcat-87fbdc964-gjtkl
exec /usr/local/tomcat/bin/catalina.sh: exec format error
this pod from a deployment has a docker image which needs to be inspected.
check the architecture of the docker image:
docker inspect --format='{{.Architecture}}' 118***650135.dkr.ecr.eu-west-1.amazonaws.com/tomcat-10.1-jdk-21:v1
arm64
check the architecture of the nodes:
kubectl get nodes -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.nodeInfo.architecture}{"\n"}{end}'
ip-10-5-12-209.eu-west-1.compute.internal amd64
ip-10-5-13-52.eu-west-1.compute.internal amd64
ip-10-5-14-208.eu-west-1.compute.internal amd64
ip-10-5-14-63.eu-west-1.compute.internal amd64
So the docker image with architecture arm64 havingn problem to live blissfully in node with architecture amd64.
a simple fix:
make changes in docker desktop
export DOCKER_BUILDKIT=1
% docker buildx create --name mybuilder --use
mybuilder
% docker buildx inspect --bootstrap
[+] Building 8.4s (0/1)
=> [internal] booting buildkit 8.4s
=> => pulling image moby/buildkit:buildx-stable-1 8.4s
....
GC Policy rule#1:
All: false
Keep Duration: 1440h0m0s
Keep Bytes: 5.588GiB
GC Policy rule#2:
All: false
Keep Bytes: 5.588GiB
GC Policy rule#3:
All: true
Keep Bytes: 5.588GiB
% docker buildx build --platform linux/amd64,linux/arm64 -t *********.dkr.ecr.eu-west-1.amazonaws.com/tomcat-10.1-jdk-21:v2 --push .