0

I am trying to deploy a containerized webapp on Openshift by a helm chart. When I deploy the app I get the following error in the pod logs -

Events:
  Type     Reason          Age                   From               Message

  Normal   Pulled          14m                   kubelet            Successfully pulled image "<private-gitlab-registry-docker-image>:latest" in 3.787555091s
  Warning  Failed          14m                   kubelet            Error: container create failed: time="2022-11-11T13:51:47Z" level=error msg="runc create failed: unable to start container process: exec: \"python3 src/myapp.py\": stat python3 src/myapp.py: no such file or directory"

Here is the dockerfile -

FROM <private-gitlab-registry-centos-image>

ADD files/etc/yum.repos.d/* /etc/yum.repos.d/

RUN yum update -y

WORKDIR /app

RUN yum install -y python-keystoneclient python3-flask python3-keystoneauth1 python3-redis python3-werkzeug python3-pip python3-keystoneclient
RUN pip install flask-caching

COPY . /app

ENTRYPOINT [ "python3" ]

CMD [ "src/myapp.py" ]

When I manually try to run this docker image, it works just fine. But when I deploy it on Kubernetes, kubelet throws the above error.

3
  • Do you have src and myapp.py in it - check the file structure in docker? Also I saw that usually is used instead of ENTRYPOINT and CMD, only CMD [“python”, “./main.py”] Nov 11, 2022 at 16:34
  • @TsvetoslavTsvetkov The file structure is correct. The container runs fine if I run it manually. Moreover, I tried changing the command to "ls app" and I get the same error - level=error msg="runc create failed: unable to start container process: exec: \"ls app/\": stat ls app/: no such file or directory". Also, I tried removing entrypoint and just adding the contents in CMD like you said but still I get "no such file or dierctory" error.
    – Masquerade
    Nov 11, 2022 at 16:36
  • Could you share pod yaml definition? Instead of ls app/, have you tried to pwd, or ls? otherwise, command: [ "/bin/sh" ] and args: [ "-c", "sleep 86400" ], then get in and troubleshoot it live.
    – SYN
    Nov 12, 2022 at 13:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.