Py学习  »  docker

docker无法启动烧瓶应用程序[复制]

shantanuo • 4 年前 • 594 次点击  

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

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" ]

文件在这里。。。 https://github.com/shantanuo/Spell-Checker/tree/master

我不知道该不该给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
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/54919
 
594 次点击  
文章 [ 1 ]  |  最新文章 4 年前
DazWilkin
Reply   •   1 楼
DazWilkin    4 年前

你的应用只监听本地主机( 127.0.0.1 )但您需要允许远程访问(通常 0.0.0.0 )

app.run(host="0.0.0.0")

见: