How to dockerize your Flask application

<h1>Introduction:</h1> <p>The objective of this post is to dockerise a minimalistic flask application. Let&rsquo;s take an example of a simple flask program and dockerise it.</p> <h1>A Simple Flask Application:</h1> <p>The below code is a bare minimum flask application with a single end point&nbsp;<code>/hello</code>. Let&rsquo;s say the module name is&nbsp;<code>my_flask.py</code>.</p> <h2>my_flask.py</h2> <pre> from flask import Flask, jsonify app = Flask(__name__) @app.route(&quot;/hello&quot;, methods=[&quot;GET&quot;]) def say_hello(): return jsonify({&quot;msg&quot;: &quot;Hello from Flask&quot;}) if __name__ == &quot;__main__&quot;: # Please do not set debug=True in production app.run(host=&quot;0.0.0.0&quot;, port=5000, debug=True)</pre> <p><a href="https://medium.com/geekculture/how-to-dockerize-your-flask-application-2d0487ecefb8"><strong>Visit Now</strong></a></p> <p>&nbsp;</p>