Skip to main content

Command Palette

Search for a command to run...

Dockerize 3 Tier Flask Web App

Updated
•1 min read•View as Markdown
Dockerize 3 Tier Flask Web App

Github link of the project.

Here I tried dockerizing a Flask web App which contains Frontend (html), Backend(Flask), and Database (mysql). Well, I first created separate the folders for frontend, backend , and database.

Then create the Dockerfile for each of the part (frontend, backend , database).

  • Dockerizing the frontend was easy

  • But for the backend and database we need to provide some Env variables so that both the containers can connect.

  • To make data storage persistent we need to create volumes so that even if the container get down the data will be persistent.

  • Even after creating the container and passing Env they wont be able to connect with each other because they don’t have a network established, so I have to create a network for this connection.

Now I also created the docker-compose.yml for this Flask Web App the only error I faced was that network creation part which I mistakenly placed inside the service block which I notice after tried running it.

That was my experience when dockerizing 3 Tier Flask Web App. Please share your thoughts , Thank you for reading.

More from this blog