Deployment Of Machine Learning model inside Docker Container

Deployment Of Machine Learning model inside Docker Container

Hello connections!!

In this article, i am going to deploy a machine learning model inside docker container. To run docker container, i used RHEL8 as base OS.

About model:- My model is based on salary prediction of employee, on the basis of working experience of employees( in years ).

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 deploy machine learning model.

let's start the task:-

step 1:- First of all i need docker container engine on base os, i have already installed docker. Command to check version:- docker --version

No alt text provided for this image

step 2:- I need first to start the docker service by using command:- systemctl start docker

No alt text provided for this image

step 3:- Now i have to pull/download container image(centos:latest)

Command to pull docker image for centos:- docker pull centos:latest

No alt text provided for this image

docker image for centos downloaded successfully. by using command:- docker images we can check available images.

No alt text provided for this image

step 4:- Now i am going to launch a docker container from docker image centos:latest by Command:- docker run -it --name my_os centos:latest

No alt text provided for this image

step 5:- Now i have to install python3 on docker container by using command:- yum install python3 -y

No alt text provided for this image

step 6:- I require some library of python to run machine learning program like:- numpy, pandas and scikit-learn. So using pip3 command i installed these library on docker container. Command used to install libraries:- pip3 install numpy pandas scikit-learn

No alt text provided for this image

Now environment for machine learning is ready, now i have to deploy my machine learning model on docker container. First of all i create a directory/workspace with name myapp on container, and copy machine learning program, .csv file on myapp workspace, from windows working space. I have created the model on jupyter notebook in windows, but my task is to run ml program on docker container.

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

step 7:- Machine Learning program for salary prediction as shown below, i use joblib library here to save my model after trained/learned my model once, we don't need to trained our model again and again, if we save the model.

No alt text provided for this image

step 8:- I write a python program to use the trained model and predict salary as shown below.

No alt text provided for this image

step 9:- Now time to test the model:- to test the model run the python program as shown in below

No alt text provided for this image

Program ran successfully and give the output, so i can say my task is completed successfully.

Thank you for reading !








要查看或添加评论,请登录

Niraj Kumar的更多文章

  • Ansible playbook for K8S multinode cluster on AWS

    Ansible playbook for K8S multinode cluster on AWS

    Hello connections!! In this blog i am going setup multi node kubernetes cluster setup on AWS by using Ansible. I wrote…

  • Case Study On AWS SQS Service

    Case Study On AWS SQS Service

    Hello connections, In this blog i am gonna discuss about SQS service of Amazon. What is Amazon SQS ? Amazon SQS is a…

  • Case Study On OpenShift

    Case Study On OpenShift

    Hello Connections, in this blog i am gonna discuss about openshift as a technology and its use cases. what is OpenShift…

  • Apache Webserver and Haproxy server configuration on AWS with Ansible

    Apache Webserver and Haproxy server configuration on AWS with Ansible

    Hello connections, in this blog i am going to configure Apache webserver and Haproxy server on AWS EC2 instance using…

  • Industry Usecases Of Jenkins

    Industry Usecases Of Jenkins

    Hello connections!! In this blog i am going to talk about Jenkins which is a automation tool/ software, mostly used in…

  • GUI Application with docker

    GUI Application with docker

    hello folks!! In this blog i am going to explain how we can run a GUI application on Docker Container. First of all we…

  • Network Topology setup

    Network Topology setup

    Hello Folks!! In this blog i am gonna discuss how we can create a network topology setup. There are three systems…

  • Amdocs with AWS cloud services

    Amdocs with AWS cloud services

    Amazon Web Services (AWS) is an evolving cloud computing platform that provides on-demand service to individuals…

  • Azure Kubernetes Service

    Azure Kubernetes Service

    Kubernetes is by far the most popular container orchestration tool, yet the complexities of managing the tool have led…

  • Neural Network

    Neural Network

    What are Neural Networks? Neural networks are a set of algorithms, they are designed to mimic the human brain, that is…

    1 条评论

社区洞察