Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker container build faild: "exec: \"flask\": executable file not found in $PATH": unknown

Tags:

docker

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.

like image 625
Dino Nguyễn Avatar asked Oct 18 '25 08:10

Dino Nguyễn


1 Answers

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.

like image 132
Niklas Avatar answered Oct 20 '25 06:10

Niklas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!