Docker exec: "/entrypoint.sh": permission denied: unknown. How to fix it?

I type docker run

docker run --name www_app -d -p 443:443 alpine-apache:latest

But getting the error:

 docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/entrypoint.sh": permission denied: unknown.
ERRO[0000] error waiting for container: context canceled c

Do I need to add following in my Dockerfile?

RUN chmod 0700 entrypoint.sh

What is the best practice here?

You need executable permission on the entrypoint.sh file. Yes, that or set up permission on the host (where you have Dockerfile and entrypoint.sh) using the chmod command. Like:

chmod +x entrypoint.sh

Then rebuild it:

docker build -t  alpine-apache .

Run it:

docker run --name www_app -d -p 443:443 alpine-apache:latest

It should work now.

1 Like

So simple solution. Why I didn’t thought of it? Many thanks.


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki