Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to fix docker: exec format error  (Read 4542 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
How to fix docker: exec format error
« on: June 16, 2018, 10:53:00 am »
For example, you want to execute the following shell script.

Code: [Select]
# /usr/local/bin/

echo "hello, world"


Code: [Select]
ADD /usr/local/bin/
RUN chmod +x /usr/local/bin/
CMD ["/usr/local/bin/"]

When you run the container, your expectation is the container prints out hello, world. However, what you will get is a error message:

$ docker run -i hello_world_image

You see this message when you didn’t put shebang in your script, and because of that, default entry point /bin/sh -c does not know how to run the script.

To fix this, you can either add shebang


Code: [Select]
echo "hello, world"

or you can specify from command line.

Code: [Select]
$ docker run -entrypoint="/bin/bash" -i hello_world_image==========================================================================
« Last Edit: June 19, 2018, 02:09:50 pm by manoj »