Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker entrypoint permission denied

I am currently trying to deal with a deployment to a kubernetes cluster. The deployment keeps failing with the response

 Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"/entrypoint.sh\": permission denied"

I have tried to change the permissions on the file which seem to succeed as if I ls -l I get -rwxr-xr-x as the permissions for the file.

I have tried placing the chmod command both in the dockerfile itself and prior to the image being built and uploaded but neither seems to make any difference. Any ideas why I am still getting the error?

dockerfile below

FROM node:10.15.0
CMD []
ENV NODE_PATH /opt/node_modules

# Add kraken files
RUN mkdir -p /opt/kraken
ADD .  /opt/kraken/
# RUN chown -R node /opt/
WORKDIR /opt/kraken

RUN npm install && \
    npm run build && \
    npm prune --production

# Add the entrypoint
COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
USER node
ENTRYPOINT ["/entrypoint.sh"]
like image 370
tacoofdoomk Avatar asked Aug 13 '19 16:08

tacoofdoomk


People also ask

How do I fix Docker permission is denied?

If running elevated Docker commands does not fix the permission denied error, verify that your Docker Engine is running. Similar to running a docker command without the sudo command, a stopped Docker Engine triggers the permission denied error. How do you fix the error? By restarting your Docker engine.

How do I fix Docker got permission denied while trying to connect to the Docker daemon socket?

Fix 1: Run all the docker commands with sudo If you have sudo access on your system, you may run each docker command with sudo and you won't see this 'Got permission denied while trying to connect to the Docker daemon socket' anymore.

Does Docker run override ENTRYPOINT?

ENTRYPOINT is the other instruction used to configure how the container will run. Just like with CMD, you need to specify a command and parameters. However, in the case of ENTRYPOINT we cannot override the ENTRYPOINT instruction by adding command-line parameters to the `docker run` command.


1 Answers

This error is not about entrypoint error but command inside. Always start scripts with "sh script.sh" either entrypoint or cmd. In this case it would be: ENTRYPOINT ["sh", "entrypoint.sh"]

like image 116
Akin Ozer Avatar answered Oct 12 '22 12:10

Akin Ozer