Hello, learners!

Over the last few days, I’ve been diving into Docker, and I’m excited to share my journey with you. In this post, I’ll walk you through my experience from Day 2 and Day 3 of my Docker workshop and how I containerized a Python application.

Day 2: Getting Started with Docker
On Day 2, I got hands-on with Docker and learned the basics of containerization. Here's what I did:

Creating the Dockerfile:
I started by writing a Dockerfile to containerize a simple Python application. This involved using the official Python image, setting up a working directory, and installing the necessary dependencies (like scikit-learn, pandas, and joblib). The script is set to run when the container starts.

Building the Docker Image:
After writing the Dockerfile, I built my Docker image using the following command:
docker build -t my-python-app .

Running the Docker Container:
Once the image was built, I ran the container with the command:
docker run my-python-app

This allowed me to run the Python script in a contained, isolated environment, ensuring that the dependencies and environment were consistent.

Day 3: Implementing the KNN Algorithm
On Day 3, I continued my journey by working with a sales dataset to implement a K-Nearest Neighbors (KNN) algorithm.

Using a Sales Dataset:
I used a dataset to predict sales performance based on features like region, sales rep, and product category. This was a great exercise in both data science and Dockerization.

Creating the Python Script:
I wrote a Python script, sales.py, that applied the KNN algorithm to the sales dataset. The script used scikit-learn to train the model and make predictions.

Dockerizing the Sales Algorithm:
After developing the script, I Dockerized the sales.py application, just like I did with the previous Python script. This ensured that the application and all its dependencies were bundled into a container, making it easy to run anywhere.

Pushing the Docker Image to Docker Hub:
Finally, I pushed the custom Docker image for the sales algorithm to Docker Hub so I could easily share and access it from anywhere.

Commands I Used:
Building the Docker image:
docker build -t my-python-app .

Running the container:
docker run my-python-app

Pushing the image to Docker Hub:
docker push my-python-app

Takeaways
Docker is a game-changer when it comes to packaging applications and their dependencies in a portable and isolated environment.

The process of creating a Dockerfile, building images, and running containers is straightforward and very powerful for developers.

Docker Hub is an excellent platform for sharing and storing your Docker images.
Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Day 3: KNN Algorithm with Docker

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description