Day 17 Task: Crafting a Dockerized Web Application 🐳✨

Day 17 Task: Crafting a Dockerized Web Application 🐳✨

Β·

2 min read

Hello, DevOps dynamos! Today's #90daysofdevops challenge was exhilarating! I rolled up my sleeves and got my hands Docker-deep in containerizing a web application. 🌐

The Magic of Dockerfile πŸ“œ

I kicked off my day by crafting a Dockerfile, the blueprint for building Docker images. It's like a recipe, outlining each step to package my web app into a container.

Here's a sneak peek into what my Dockerfile adventure entailed:

Writing the Dockerfile πŸ–‹οΈ

  • Started with a base image: For my Django app, python:3.8-slim was a perfect start.

  • Crafted the steps:

    • Set a working directory: WORKDIR /app

    • Copied the project files into the image: COPY . /app

    • Installed the dependencies: RUN pip install -r requirements.txt

    • Exposed the port the app runs on: EXPOSE 8000

    • Defined the command to start the server: CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]

Building the Image πŸ—οΈ

  • Ran docker build -t my-django-app . to transform my Dockerfile into a runnable image.

  • Watched the build process closely, ensuring each step was executed without hiccups.

Running the Container πŸš€

  • Used docker run -d -p 8000:8000 my-django-app to breathe life into my image, creating a container.

  • The -d flag meant it ran in the background, and -p connected the container port to my host.

Ensuring Everything's Shipshape πŸ–₯️

  • Navigated to http://localhost:8000 on my browser and was greeted by my Django app's welcome page.

  • It was alive! The application responded to my requests, just as it would in its natural server habitat.

Docking the Image on Docker Hub πŸ“€

  • I tagged my image with docker tag my-django-app username/my-django-app:latest.

  • Pushed it to Docker Hub with docker push username/my-django-app:latest.

  • Now, my container was not just on my machine but out in the world for others to pull and use!

Wrapping Up the Day's Voyage πŸ—ΊοΈ

Today, Docker demystified, I feel like a true DevOps Engineer, ready to containerize the digital worldβ€”one Dockerfile at a time. Stay tuned for more DevOps adventures and mishaps! #Day17 #DevOpsProject #DockerizeAllTheThings #Containerization #DockerHub πŸ³πŸš€

Thank you for reading this Blog. Hope you learned something new today! If you found this blog helpful, please like, share, and follow me for more blog posts like this in the future.

You can connect with me at: https://www.linkedin.com/in/davendersingh/

Β