简体   繁体   中英

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

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

I created a github action with a Dockerfile and entrypoint.sh file. I run command 'chmod +x' in my computer and push to github repository. I did not RUN 'chmod +x' in Dockerfile. It works.

托盘 docker exec -it /bin/sh

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM