Reputation:
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" ]
Upvotes: 0
Views: 154
Reputation: 12089
ENTRYPOINT
syntax requires either
ENTRYPOINT [ "python", "hello.py" ]
exec form, recommended
ENTRYPOINT python hello.py
shell form
Upvotes: 0