Docker Run - Error Permission Denied on CMD ["/node/execure.sh"]

When running a docker image I get Permission Denied error because of CMD ["/node/execure.sh"]. Details below:

  • Docker Version: 1.12.0-rc2
  • I am running on MacBook Pro 10.11.5
  • I am basing the image on ubuntu 14.04
  • I am setting it up for nodejs
  • I created a sample code (most basic nodejs app) to narrow it down to only dockerfile. Docker file is attached.
  • based on my investigation when I take out CMD ["/node/execute.sh"] from Dockerfile, the image runs ok, when put it in running the image fails with the following error message:
    docker: Error response from daemon: oci runtime error: exec: “/node/execute.sh”: permission denied.
  • the run command I run is below:
    docker run -i -t sepigh/node_helloworld:

I had a similar problem and I have fixed it now.

Two things to pay attention to:

  • Make sure you have a shebang line at the top of your *.sh file
    shebang line in this case: #!/bin/sh

  • Make sure your file is marked as an executable. You can do that by adding this line to your Dockerfile:
    RUN [“chmod”, “+x”, "/node/execure.sh”]

1 Like

Thanks.
Replacing RUN chmod 744 executable.sh with RUN ["chmod", "+x", "executable.sh"] solved my issue.

1 Like

You just saved me a lot of stress. Thank you so much @hacksdump

I got really good information from this content.thanks for sharing.
walgreenslistens