Reputation: 53
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.
Upvotes: 4
Views: 7105
Reputation: 1610
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.
Upvotes: 3