Docker entrypoint permission denied

tacoofdoomk picture tacoofdoomk · Aug 13, 2019 · Viewed 11.7k times · Source

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"]

Answer

Akin Ozer picture Akin Ozer · Aug 13, 2019

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"]