What is Machine Learning?
In simple words, Machine Learning is the concept that includes different types of algorithms through which we provide intelligence to a machine to work/predict something on itself on a particular dataset

What is Docker?
Docker is a platform that provides various operating systems so that the manual time required to install an operating system and then log in as a user and after that, we open an application, is reduced to seconds with the use of docker as it provides an operating system then and there and downloads it & installs within seconds.

First of all, we will upload our machine learning model file and dataset file on Github so that it makes it easy for us to fetch the files from there with the help of cloning

We will open Redhat Linux in our VM and through ifconfig command, will note the IP of our user in Redhat

Download and install Putty(Generally used for connecting with another operating system and SSH provides a secure, encrypted connection to the remote system) and then type the IP that you noted in the previous step

After that it will open a terminal in which it will prompt for the username and password of your Redhat Linux user, enter it and then your RedHat system will be opened in this terminal, prompting with
[root@localhost `]#

Create a workspace for yourself, here I have done the same by creating a directory named ML for cloning the files from GitHub

Clone the necessary files for running our model from GitHub repository to the ML directory

Here we can see that .csv file as dataset and .pk1 as our model has been successfully copied into our ML directory
Now, we will focus on installing docker on our system
cd /etc/yum.repos.d

Navigate to /etc/yum.repos.d for creating a docker.repo file so that when we provide command for docker installation as yum install docker-ce then the system will check in yum.repos.d in all the .repo file for the url for downloading and installing docker from that URL.

Installing vim editor for writing code inside docker.repo file
Create a file with
vim docker.repo
[docker]
baseurl = https://download.docker.com/linux/centos/7/x86_64/stable/
gpgcheck = 0

Inside docker.repo, write the above codes for successful installation of Docker and save the file by pressing Esc and then:wq
yum install docker-ce --nobest

command for installing Docker and after that docker will be successfully installed in your Redhat
systemctl start docker

Start Docker
docker pull centos

Use the command docker pull with os_name for installing the particular os/container or pulling the image file of that particular os/container, here I have pulled centos os

docker run -it --name skos centos
For running the os and giving name to the os as skos
docker ps -a

Checking whether the os has been successfully installed or not
Now you are successfully inside your container/os
yum install python3

Install python with the above code inside your container/os
pip3 install numpy pandas scikit-learn

Install numpy, pandas & scikit-learn libraries from python for successfully training your machine learning model
Now copy your file required for machine learning model inside docker container using the following command
docker cp file_name os_name:/directory_path

checking for successful copy of files
Here I have created a python file model.py for running my machine learning model
vim model.py
import joblib
test = joblib.load("salary.pk1")
print(test.predict([[int(input("Enter the number of years of experience for which you want to predict the salary = "))]]))

code for running my model, here I have imported my model “salary.pk1” through joblib library and then saved it

Run the python file and here as you can see, my machine learning model is working perfectly fine and predicting the result for 15 years of experience.
Thank you for visiting my blog, if you have any queries you can dm me on Linkedin and do like and comment your views after reading this blog 😃