Question

Does anybody know how to fix this exec format error?

Posted January 29, 2021 871 views
FAQ

star-trek-13 | 21:21:18 INFO[0013] RUN apt-get update && apt-get install -y –no-install-recommends git ca-certificates
star-trek-13 | 21:21:18 INFO[0013] Taking snapshot of full filesystem…

star-trek-13 | 21:21:20 INFO[0015] cmd: /bin/sh

star-trek-13 | 21:21:20 INFO[0015] args: [-c apt-get update && apt-get install -y –no-install-recommends git ca-certificates]
star-trek-13 | 21:21:20 INFO[0015] Running: [/bin/sh -c apt-get update && apt-get install -y –no-install-recommends git ca-certificates]
star-trek-13 | 21:21:20 error building image: error building stage: failed to execute command: starting command: fork/exec /bin/sh: exec format error
star-trek-13 | 21:21:20 exit status 1
star-trek-13 | 21:21:20 ! Build failed (exit code 1)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

Hi @benroberts23,

I recently hit this issue with my own application. After chatting with engineering this appears to be an issue with architecture as @Yannek mentioned.

App Platform is using gVisor for the execution of the applications under the hood. Looking at the gVisor docs, the following limitations would also apply to App Platform:

gVisor supports Linux ELF binaries.

Binaries run in gVisor should be built for the AMD64 or AArch64 CPU architectures.

In short, 32-bit binaries will fail to execute on App Platform. I would recommend looking for a 64-bit version of your executable if possible.

Hope this helps!

Regards,

John Kwiatkoski
Senior Developer Support Engineer - Kubernetes

Hi,
‘Exec format error’ might be related to processor architecture mismatch. Can you provide more detailed info on the environment that you utilise for building the image (host OS, VM OS, container OS) ?