Dockerize 3 Tier Flask Web App

Subrat YadavSubrat Yadav
1 min read

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.

0
Subscribe to my newsletter

Read articles from Subrat Yadav directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Subrat Yadav
Subrat Yadav