2
votes

I'm learning docker. I try run a sample dockerfile on docker,com. But I have a problem is "Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"flask\": executable file not found in $PATH": unknown ".

FROM python:3.7-alpine

WORKDIR /code
ENV FLASK_APP app.py
ENV FLASK_RUN_HOST 0.0.0.0
RUN apk add --no-cache gcc musl-dev linux-headers
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . .
CMD ["flask","run"]

Many thanks.

1
Do you have flask in requirements.txt? Please wrap your Dockerfile in a code block so it is easier to read. - vkozyrev
Thank you, I checked the requirements.txt. I have two line: flask and redis. I follow this : docs.docker.com/compose/gettingstarted - Dino Nguyễn
Could you update commands you used with docker for your question? - Niklas

1 Answers

2
votes

Seems like flask is not found from the PATH. It is either not installed (is it in requirements.txt?), or just not added into path.

You could try to set CMD ["python", "-m", "flask", "run"] instead.

Edit: Example here works for me well. https://docs.docker.com/compose/gettingstarted/

You could try to pass --no-cache option to just in case make clean image: docker build --no-cache -t test . and then run docker run test

When attempting to test image, before going into docker-compose state.