Docker容器构建失败:"exec:\" flask \":在$ PATH中找不到可执行文件":未知 [英] Docker container build faild: "exec: \"flask\": executable file not found in $PATH": unknown
问题描述
我正在学习docker.我尝试在docker,com上运行一个示例dockerfile.但是我有一个问题是来自守护程序的错误响应:OCI运行时创建失败:container_linux.go:345:启动容器进程导致"exec:\" flask \":在$ PATH中找不到可执行文件":未知.
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"]
非常感谢.
推荐答案
在PATH中找不到类似 flask
的东西.它未安装(是否在requirements.txt中?),或者只是未添加到路径中.
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.
您可以尝试设置 CMD ["python",-m","flask","run"]
.
这里的示例对我来说很好. https://docs.docker.com/compose/gettingstarted/
Example here works for me well. https://docs.docker.com/compose/gettingstarted/
您可以尝试将-no-cache
选项传递给以防万一,制作出清晰的图像: docker build --no-cache -t test.
然后运行 docker run test
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
尝试测试映像时,先进入docker-compose 状态.
When attempting to test image, before going into docker-compose
state.
这篇关于Docker容器构建失败:"exec:\" flask \":在$ PATH中找不到可执行文件":未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!