All Collections
Troubleshooting
exec user process caused "exec format error"
exec user process caused "exec format error"
Container moves to CrashLoopBackOff and the container log displays "exec format error"
Vinothini Raju avatar
Written by Vinothini Raju
Updated over a week ago

Scenario

When the application is deployed, the service moves to pending state and the container moves to Waiting state with the reason as CrashLoopBackOff. The container logs show the error standard_init_linux.go:178: exec user process caused “exec format error”

Reason 1:

This error is encountered when trying to run a go binary inside a Docker container. This is because the host machine and the Docker container have different architectures and operating systems. The go binary must be compiled for the architecture and operating system of the Docker container in order for it to be executed.

Solution

If you are onboarding a Dockerfile based container then make sure the right architecture is specified in your build command. Say, for instance, if you are building the binary on a MacOS, but your runtime Docker container is based on Ubuntu, you can compile your binary like below:

GOOS=linux go build -o myprogram

Reason 2 :

This error could appear due to missing script header like #!/bin/bash or #!/bin/sh in the container start script. The error may also occur due to any empty line or space before the script header.

Solution

Click on the info link for the container, and edit the start script to include the header as the first line of the start script. Save the start script.

Here is an example of how a startscript with script header:

#!/bin/bash
npm start

This will automatically restart the replica after a few seconds. If you desire to restart the replica immediately, you can click on the Delete option next to the replica. This will bring down the replica and create a new replica with the updated start script in the container.

Did this answer your question?