Docker不允许我ctrl-C退出Flask应用程序

时间:2018-06-21 18:42:39

标签: docker flask

我正在使用docker设置和维护我的Flask应用程序的开发环境。不幸的是,在我使用以下方法启动应用后:

docker run -i -p 8000:8000 vosw2

我无法使用输出指定的Ctrl-C终止应用程序的运行。

$ docker run -i -p 8000:8000 vosw2
WebSocket transport not available. Install eventlet or gevent and gevent-websocket for improved performance.
Scheduled cache cleaning: cache has been cleaned :)
Scheduled cache update: cache is up to date :)
 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:8000/ (Press CTRL+C to quit)
 * Restarting with stat
WebSocket transport not available. Install eventlet or gevent and gevent-websocket for improved performance.
 * Debugger is active!
 * Debugger PIN: 183-524-396

关于为什么以及如何解决此问题的任何想法?

我的Dockerfile如下所示:

# Use an official Python runtime as a parent image
FROM python:2.7-slim

# Set the working directory to /EducationWebApp
WORKDIR /EducationWebApp

# Copy the current directory contents into the container at /EducationWebApp
ADD . /EducationWebApp

# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt

# Make port 8000 available to the world outside this container
EXPOSE 8000

# Run app.py when the container launches
CMD ["python", "app.py"]

然后我用docker build -t vosw2 .来制作图片。

0 个答案:

没有答案
相关问题