【发布时间】:2020-05-12 16:56:08
【问题描述】:
$ docker image build -t python-blog .
Step 1/5 : FROM ubuntu:16.04
---> 005d2078bdfa
Step 2/5 : RUN apt-get update -y && apt-get install -y python-pip python-dev
---> Using cache
---> 7c1fdabcc215
Step 3/5 : ADD . .
---> Using cache
---> 5e2784fac3bd
Step 4/5 : RUN pip install -r requirements.txt
---> Using cache
---> 7d038ff8d993
Step 5/5 : CMD ["/usr/bin/python3","run.py"]
---> Using cache
---> 24f691d13886
Successfully built 24f691d13886
Successfully tagged python-blog:latest
$ docker run -p 5000:5000 python-blog:latest
docker:来自守护进程的错误响应:OCI 运行时创建失败: container_linux.go:349:启动容器进程导致“exec: \"/usr/bin/python3\": stat /usr/bin/python3: 没有这样的文件或 目录”:未知。ERROr [0005] 错误等待容器:上下文 取消
Dockerfile
FROM ubuntu:16.04
RUN apt-get update -y && \
apt-get install -y python-pip python-dev
ADD . .
RUN pip install -r requirements.txt
CMD ["/usr/bin/python3","run.py"]
【问题讨论】:
-
你可能想安装 python3-pip 和 python3-dev 并使用 pip3。
-
非常感谢,您的更改有效@hmm
标签: python-3.x docker flask dockerfile