Creating our Flask Application

The first step is, of course, creating our Flask application. Here is our demo-dockerflask folder structure:

.

├── Dockerfile

└── app

├── app.py

└── requirements.txt

The requirements.txt has only the following:

requirements.txt

The app.py file has the following:

app.py

Notice that inside the app.run() params we have host="0.0.0.0" . This is a necessity, as 0.0.0.0 is a wildcard IP address that will match any possible incoming port on the host machine. This will make a bit more sense when we run our container.