Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 730 Bytes

ReadMe.md

File metadata and controls

40 lines (31 loc) · 730 Bytes

Build simple docker container

Docker tutorial

First Pythong web application

  1. install flask
pip install flask
pip install flask_restful
  1. create api.py
from flask import Flask
from flask_restful import Resource, Api

app = Flask(__name__)
api = Api(app)

class Product(Resource):
    def get(self):
        return{
            'product': ['Ice cream',
                        'Chocolate',
                        'fruite']
        }

api.add_resource(Product, '/')

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=80, debug=True)
  1. run the application
sudo python api.py
password: qianjiang
  1. stop the application: Ctrl+c