Member-only story

Create a Running Docker Container With Gunicorn and Flask

The simplest container setup imaginable. Start here

Maroun Maroun
Better Programming
2 min readNov 4, 2020

--

Building’s foundation
Photo by Mirko Blicke on Unsplash.

Let’s begin by creating a minimal Flask application:

Next, let’s write the command that will run the Gunicorn server:

The parameters are pretty much self-explanatory: We are telling Gunicorn that we want to spawn two worker processes running two threads each. We are also accepting connections from the outside and overriding Gunicorn’s default port (8000).

Our basic Dockerfile:

--

--

Maroun Maroun
Maroun Maroun

Written by Maroun Maroun

Software engineer | Music geek | Beer lover

Responses (5)