docker无法启动flask应用程序

docker无法启动flask应用程序,docker,flask,Docker,Flask,flask应用程序已启动,但我无法从浏览器中查看任何内容 root@1ec89cb3dad1:/app# python main.py * Serving Flask app "main" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI ser

flask应用程序已启动,但我无法从浏览器中查看任何内容

root@1ec89cb3dad1:/app# python main.py
 * Serving Flask app "main" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 231-587-342
Dockerfile如下所示:

FROM ubuntu
RUN apt-get update -y && \
    apt-get install -y python-pip python-dev  libhunspell-dev
WORKDIR /app
COPY ./requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt
COPY . /app
ENTRYPOINT [ "python" ]
CMD [ "main.py" ]
文件在这里。。。

我不确定我是否应该标记docker或flask


更新:

我使用这些命令来构建和运行图像

git clone https://github.com/shantanuo/Spell-Checker.git

cd Spell-Checker/

docker build -t shantanuo/flask .

docker run -p 5000:5000 shantanuo/flask

您的应用程序正在侦听localhost(
127.0.0.1
),但您需要允许远程访问(通常为
0.0.0

您的代码应该设置
app.run(host=“0.0.0.0”)

见:

  • “外部可见服务器”

您是否安装了正确的端口?你也可以添加docker run命令吗?