【发布时间】:2021-01-20 21:11:20
【问题描述】:
Dockerfile
from ubuntu:latest
RUN apt-get update -y && apt-get install -y python3-pip
COPY . /app
RUN pip3 install -r /app/requirements.txt
ENTRYPOINT ["python3"]
CMD ["app/app.py"]
运行命令
docker build -t flaskapp .
docker run -it -d p 5000:5000 flaskapp
如果我通过 Postman 向 localhost:5000 发送请求,我会收到 Error: Socket hang up 错误
有人知道为什么会出现这个问题吗?
【问题讨论】:
-
从
docker run中删除-d标志以查看终端中的容器日志,这可能会揭示问题(如果没有,请编辑您的问题以附加该日志)。 -
使用 curl 时,我得到一个
Recv failure: connection reset by peer -
@v25 没有错误。烧瓶应用程序在本地运行