Deployed Machine Learning Model Within Docker Container

In this article, We will learn how to deploy a Machine Learning Model inside a docker container using centos image
TASK DETAIL DESCRIPTION
👉 Pull the Docker container image of CentOS image from DockerHub 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 which you have created in the Jupiter notebook
PREREQUISITE:
📌OPERATING SYSTEM: (RHEL8)
📌DATASET: (SALARY PREDICTION)
So in this article, we are using RHEL8 OS for deploying our model inside Docker Container. Secondly, you need to download the dataset in which you will going to work here we have used the Salary prediction dataset which is downloaded from google.
Kaggle is a site where you will find a lot of datasets in which you can start working choose according to your interest
Let’s begin with the demonstration✨
STEP 1: Install Docker
Yum install docker

Step 2: Start Docker Services
systemctl start docker
Check the status of Docker by running the below command
systemctl status docker

There is one more way to verify that Docker Engine is installed correctly by running the hello-world image.
docker run hello-world

Step 3: Pull Centos Image
docker pull centos:7

Step 4: Launching the Docker Container
docker run -it newOS centos:7
After launching the container you will be inside the new os as you can see the below fig new Id has been assigned to the container

Step 5: Install Python
yum install python3

Step 6: Install the libraries that we required in our ML model
pip3 install numpy
pip3 install pandas
pip3 install scikit-learn

Step 7: Transferring data from windows to Linux os
First we need to transfer our salary prediction dataset into the base os system then from there we will transfer the data inside the docker container.
You can transfer the file using Winscp software
when you enter command ls you can see your SalaryData.csv file as shown in the given fig

Step 8:Copy the dataset inside Docker Container
If you want to know which command is used for copying the dataset take help
docker cp — help


Check by using ls command inside docker container and you can see salarydataset has been loaded inside the container

Step 9: Write the Final Code:

Step 10 : Run the Final Code

You have successfully deployed the ML model inside Docker Container!🎊💥

You are free to give suggestions regarding my blog🙂
By: Shristi Sharma