Deploying Machine learning Model on Docker :
In this article I am going to perform a task in which I'll use docker container to deploy machine learning model
Task Description ??
?? Pull the Docker container image of CentOS image from DockerHub and create a new container.
?? Install the Python software on the top of docker container.
?? In container you need to copy/create machine learning model which you have created in jupyter notebook.
What is Machine Learning?
Machine Learning is the study of computer algorithm that allows software to become more accurate by predicting outcomes. It is an application of Artificial Intelligence that provides systems the ability to automatically learn and improve from experience without being explicitly programmed. ML focuses on the development of computer programs that can access data and use it learn from themselves.
What is Docker?
Docker is a software platform that allows you to build, test, and deploy applications quickly. It works by providing a standard way to run your code. Docker is an operating system for containers. Similar to how a virtual machine virtualizes (removes the need to directly manage) server hardware, containers virtualize the operating system of a server. Docker is installed on each server and provides simple commands you can use to build, start, or stop containers.
So, Let's start.....
Step 1: First we have to configure YUM repository
Step 2: Then we have to install Docker in our Base OS in my case it is already installed.
Step 3: Now we will pull CentOS image of OS from DockerHub using the command
docker pull centos:latest
Step 4: Now we have to start docker services and launch
systemctl start docker docker run -it --name sneha centos:latest
Step5:Install the python3 in docker container by command
yum install python3
Step 6: Install pandas library inside docker container by using command
pip3 install pandas
Step7: Install scikit-learn library inside docker container by command pip3 install scikit-learn.
Step8: Now we will create a folder and give it a name in my case folder name is MLmodel, and folder will be created by using command
mkdir MLmodel
Step9: After creating this folder we will go inside it by using command
cd MLmodel
Step 10: Okay so proceeding towards next step here we will create a dataset file by giving some data and I am giving file name dataset.csv and the command to open the file is;
vi dataset.csv
when will run the command this type of file will open and we will give some data here
??Note: After opening the file press i for insert mode and after entering data, press esc key and :w to save the file and :q to quit from that file
Step 11: Now create a python file by command vi model.py and write a Machine Learning code that is given below in image:
Step 12: Run python file(model.py) for prediction by command python3 model.py
Now, our file runs successfully and it gives output(hours of study) on the basis of dataset.
Your Machine Learning Model is ready ?.............
THANK YOU