Kubernetes pods are going into crashloop backoff :Saying permission denied on starting the container

4/1/2019

I'm getting a case of CrashLoopBackoff while my logs say:

"/abc.sh" permission denied.

This is my DockerFile:

FROM python:3.6.3

COPY abc.sh /abc.sh

CMD["/bin/bash","-c","/abc.sh"]

The entry point is given in deployment.yml file. After I apply the deployment.yml with the image created by above DockerFile, it shows:

/abc.sh permission denied.

Despite the fact that permissions are 755 on /abc.sh and /abc.sh is having owners as root:root.

I have already tried:

FROM python:3.6.3

COPY abc.sh /abc.sh

USER root

CMD["/bin/bash","-c","/abc.sh"]

and

FROM python:3.6.3

COPY abc.sh /abc.sh

USER root

CMD ["su","-","root","/bin/bash"]

CMD["/bin/bash","-c","/abc.sh"]

I want to start the pod with 2 scripts: 1)one is entry point which is in deployment file 2)other is in Dockerfile

-- Nancy
dockerfile
kubernetes
unix

1 Answer

4/1/2019

You don't need to use root for this case. This is happening because your shell script is not permitted to execute or an executable. You need to run the following before you run the shell script:

chmod +x /abc.sh
-- cookiedough
Source: StackOverflow