Failed to load /usr/bin/bash: exec format error

Posted May 21, 2021 678 views

Hi, I create docker image with bash for run 2 application



If I run docker local docker run -it --rm {name} all work fine. I catch error if deploy on do app

[2021-05-21T19:37:47.694599036Z] starting container: starting non-root container [bash ./]: creating process: failed to load /usr/bin/bash: exec format error
edited by MattIPv4

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
1 answer

Hi there @eaglemoor,

It looks like that you don’t have bash installed inside the container. You could instead try using sh:

RUN /bin/sh

Or alternatively, you could install bash. Depending on the Docker image that you are using you could add an install step in your Dockerfile. For example if you are using Apline as your base image this would look like this:

RUN apk update && apk add bash

If you are using Ubuntu or Debian it would need to be updated to apt update && apt install bash.

Let me know how it goes.