【发布时间】:2020-02-28 13:05:42
【问题描述】:
我正在尝试通过 docker 运行烧瓶。
我的码头文件:
FROM python:3
# set a directory for the app
WORKDIR /usr/src/app
# copy all the files to the container
COPY . .
# install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# tell the port number the container should expose
EXPOSE 3000
# run the command
ENTRYPOINT ["python", "app.py"]
我的 app.py
import os
from flask import Flask, request, jsonify
from submission import SubmissionResult
app = Flask(__name__)
@app.route("/health")
def health_check():
return "healthy"
if __name__ == "__main__":
app.run(debug=True)
我跑了docker run <my_image>。
当我在邮递员上点击“/health”时,我收到一条错误消息:
Could not get any response
There was an error connecting to .
Why this might have happened:
The server couldn't send a response:
Ensure that the backend is working properly
Self-signed SSL certificates are being blocked:
Fix this by turning off 'SSL certificate verification' in Settings > General
Proxy configured incorrectly
Ensure that proxy is configured correctly in Settings > Proxy
Request timeout:
Change request timeout in Settings > General
这很奇怪,因为我的烧瓶应用程序没有显示任何调试日志,所以大概请求没有到达服务器。我没有正确暴露端口吗?
我该如何解决这个问题?
【问题讨论】: