Day 2: Building My First Flask App with Docker β DevOps Journey Begins
π Aspiring Cloud & DevOps Engineer | AWS Free Tier User | Learning by Building
Hi, Iβm Sukaran Mahajan β I am working as System Administrator and currently on a focused journey to become job-ready in AWS Cloud, DevOps, and Infrastructure automation. With a growing foundation in Linux, Git, Docker, and Terraform, Iβm documenting everything I learn to help others and strengthen my understanding.
π‘ Currently Learning: β’ AWS (EC2, S3, IAM, VPC, Lambda) β’ Docker, Terraform & Ansible β’ CI/CD tools (GitHub Actions, Jenkins) β’ Kubernetes basics
π Hands-on Projects: β’ Flask + Docker App Deployment β’ Terraform-based AWS Infrastructure β’ EC2 SSH automation & S3 access control
π I also write beginner-friendly technical blogs on Hashnode: π https://devopswithsukaran.hashnode.dev
πΌ Open to internships, DevOps/cloud roles, and collaborative projects.
Letβs connect and grow in tech together! π
---
π Title:
Day 2: Building My First Flask App with Docker β DevOps Journey Begins
---
π§ Description (For Hashnode SEO):
Today I containerized my first Python Flask application using Docker. I learned how to write a Dockerfile, run a container, and understand the importance of __name__ in Flask. Follow along my DevOps journey from scratch!
---
π Blog Content:
# π Day 2: Building My First Flask App with Docker
Hey everyone! π
Welcome to **Day 2** of my DevOps learning journey. I'm sharing everything I learn each day as I move toward my goal of becoming a DevOps engineer. Today, I built my first Flask application and containerized it using Docker.
---
## π§ What I Did Today
I created a small Flask web application, then used Docker to containerize and run it. This is my first step toward understanding how apps run in isolated environments β something essential in DevOps.
---
## π Project Structure
flask-docker-app/ βββ app.py βββ requirements.txt βββ Dockerfile
---
## π§ app.py Code
```python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
return "π Hello from Flask inside Docker on EC2!"
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
\> I learned the difference between __name__ and --name--, and why it's important to write it properly.
---
π¦ Dockerfile
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt requirements.txt
COPY app.py app.py
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5000
CMD ["python", "app.py"]
---
βοΈ How I Built and Ran the Image
docker build -t flask-py .
docker run -p 5000:5000 flask-py
Then I opened my browser and visited:
http://localhost:5000
β My app worked!
---
π‘ Key Learnings
Flask basics and routing
Difference between Flask(__name__) vs Flask(--name--)
Docker basics: image, container, ports
How to write a Dockerfile
---
π Next Steps (Tomorrow)
Deploy this Docker app on AWS EC2
Learn to SSH into EC2 and run containers
Link GitHub and LinkedIn to showcase the project
---
π¬ Final Thoughts
Even though I come from a system administration background, learning Docker and Flask felt very exciting. I now understand how containers work and why theyβre so useful in DevOps pipelines.
Stay tuned for more updates. If youβre on a similar path, letβs connect on LinkedIn!
#DevOps #Docker #Flask #AWS #100DaysOfCloud #HashnodeBlog
---