这一次,我要用+Docker+部署一个用+Python+编写的+Web+应用。这个应用的代码部分(app.py)非常简单:
from flask import Flask import socket import os app = Flask(__name__) @app.route(\'/\') def hello(): html = "<h3>Hello {name}!</h3>" \ "<b>Hostname:</b> {hostname}<br/>" return html.format(name=os.getenv("NAME", "world"), hostname=socket.gethostname()) if __name__ == "__main__": app.run(host=\'0.0.0.0\', port=80)