0

Why does the first Dockerfile does not work? Meaning that it reports docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"python3 hello.py\": executable file not found in $PATH": unknown. ERRO[0001] error waiting for container: context canceled, where as the second Dockerfile works like a charm?

In other words, why do I need a shell script to run a python script inside the container?

Dockerfile 1:

FROM python:3.7-alpine
COPY hello.py .
ENTRYPOINT [ "python hello.py" ]

Dockerfile 2:

FROM python:3.7-alpine
COPY hello.py .
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT [ "entrypoint.sh" ]

1 Answer 1

0

ENTRYPOINT syntax requires either

  • ENTRYPOINT [ "python", "hello.py" ] exec form, recommended

  • ENTRYPOINT python hello.py shell form

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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