Deploying Simple Machine Learning Model inside Docker Container

Deploying Simple Machine Learning Model inside Docker Container

As part of the MLOPS Summer Internship,

Here is the first task that was given to us:

#Task1 👨🏻‍💻 #MLOps_Summer2021

Task Description 📄

👉 Pull the Docker container image of CentOS image from Docker Hub and Create a new container

👉 Install the Python software on the top of the docker container

👉 In Container you need to copy/create a machine learning model

So let's begin the demonstration.

1. Installing docker in base OS:

Here I'm using RHEL8 and I have already installed docker.

No alt text provided for this image

2. Pulling the Centos image from docker hub

No alt text provided for this image

By using docker pull and then image name command I have pulled centos images

We can also see the available images with us using the docker images command.

3. Launching a Docker container using the centos image

No alt text provided for this image

We can see all the running container details using the docker ps command

By using docker run -it --name mlindocker centos command we launched docker container with centos image and with container name as mlindocker.

4. Copying the dataset into the container

No alt text provided for this image

By using cp we copied the dataset file into docker

No alt text provided for this image

5. Installing python3 software inside the docker container

No alt text provided for this image

6. Installing the necessary libraries (numpy, pandas, scikit-learn) using pip3

pip3 install numpy

pip3 install pandas

pip3 install scikit-learn

No alt text provided for this image

7. Writing the ML code

First, let's see the code in jupyter notebook

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Let's write the same code in the container also

No alt text provided for this image

Now we are set to run the model file

No alt text provided for this image

As we can see when we enter the number of years of experience the ML model is giving the expected salary.

Github_link: https://github.com/manibhargava4/MLOPS_Internship_Task_1.git

We have successfully deployed the ML model inside Docker Container


To view or add a comment, sign in

More articles by Mani Bhargava Banka

  • Microservices Design Principles and Design Patterns

    What is Microservice Architecture? An architectural approach of microservices, or microservice architecture, organizes…

    3 Comments
  • Exploring espeak-ng options

    In this article, we will look into some options of espeak-ng command in RHEL 8. What is espeak-ng? espeak-ng is a…

  • Fun commands in Linux to explore

    In this article, we will explore some fun commands in RHEL8. For a Linux user, the terminal or command line is a…

  • Exploring different date command options in RHEL

    In this article we will see different options of date command in RHEL8. Date commands prints or sets the system date…

  • Exploring Zenity command in RHEL8

    In this article, we will see different options in zenity and their usage. zenity is a program that will display GTK+…

  • Checking Ram data for Variables like x = 5 etc...

    While learning programming languages, many used to tell that the variables that we define will be there inside the RAM…

  • K-means Clustering use case

    What is K-means clustering? The task of cluster analysis is grouping a set of objects in a way that objects in the same…

  • How Companies are using Javascript?

    There’s no denying that JavaScript is everywhere, but just how are some of the world’s largest tech companies using…

  • Using ML to classify Cyber Crime Offenses and Confusion Matrix

    This article is part of the Summer Internship MLOPS program. So in this, I'm focusing mainly on how confusion matrix…

  • GUI Container on the Docker

    As part of the summer internship I'm creating this article to solve one of the tasks given below: Summer - Task 02…

Others also viewed

Explore content categories