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

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

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

in case someone else comes across this. i encountered this issue when building images on the m1 max macbook (ARM64).

i believe this is because the VM host DO uses expects AMD64 only.

you can confirm this with:

docker inspect <image ID> --format '{{.Architecture}}'

# you can get image ID with
docker image ls

when built through docker desktop on macOS you get

docker inspect <image ID> --format '{{.Architecture}}'

when built on a native linux docker host you get

docker inspect <image ID> --format '{{.Architecture}}'

if you get arm64 then you will see this issue when you deploy.

here is another DO thread discussing this in detail

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. Regards, Bobby