docker run –entrypoint "python /path/to/file.py" cause "no such file or directory: unknown." error

  docker

Running docker run -it --entrypoint "bash" fnb-backend and then python /app/main/src/api/frontend/customer_api/customer_api.py in container shell works fine.

Consider Dockerfile below:

FROM python:2.7.18-slim
COPY main/requirements.txt .
RUN cat requirements.txt | xargs -n 1 pip install --no-cache-dir; exit 0
ENV PYTHONUNBUFFERED True
COPY . ./app/
RUN mkdir -p /app/main/logs/flask/ && touch /app/main/logs/flask/webhook_api.log
# below works
#ENTRYPOINT python /app/main/src/api/frontend/customer_api/customer_api.py

The commented out line works fine too.

However running docker run --entrypoint "python /app/main/src/api/frontend/customer_api/customer_api.py" fnb-backend cause:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "python /app/main/src/api/frontend/customer_api/customer_api.py": stat python /app/main/src/api/frontend/customer_api/customer_api.py: no such file or directory: unknown.
ERRO[0000] error waiting for container: context canceled 

Source: Docker Questions

LEAVE A COMMENT