Public Repository

Last pushed: 2 years ago
Short Description
Docker python-slim image with uWSGI and Nginx for Flask applications in Python
Full Description

Creating a Flask project with Docker

Note: These instructions are for the flask tag and are intended for a general purpose Flask web application.

Or you may follow the instructions to build your project from scratch:

  • Go to your project directory
  • Create a Dockerfile with:
FROM sicnarf/slim-uwsgi-nginx-flask

COPY ./app /app
  • Create an app directory and enter in it
  • Create a file (it should be named like that and should be in your app directory) with:
from flask import Flask
app = Flask(__name__)

def hello():
    return "Hello World from Flask"

if __name__ == "__main__":'', debug=True, port=80)

the main application object should be named app (in the code) as in this example.

  • Go to the project directory (in where your Dockerfile is, containing your app directory)
  • Build your Flask image:
docker build -t myimage .
  • Run a container based on your image:
docker run -d --name mycontainer -p 80:80 myimage
Docker Pull Command