Running Machine Learning Model for Predicting the Salary inside the Docker Container

Buddhiprakash Jain
4 min readMay 27, 2021

Hello Everyone!!🖐

In this blog I am going to create the Machine Learning Model for Predicting the Salary inside the Docker Container💧 that is running on the top of Redhat Linux 8🔴.

For setup this Environment Technologies that are integrate:-

💥Redhat Linux 8

💥 Docker

💥Python

💥 Machine Learning

For Creating the the same Machine Learning Model you need to follow the steps that are given below:-

STEP 1:-

For creating Machine Learning Model you need download dataset(SalaryData.csv) through given below my github repo link :-

STEP 2:-

Start the Docker service by command systemctl start docker

Start docker service

STEP 3:-

Check the Status of Docker Service by command systemctl status docker

your docker service is running

STEP 4:-

Pull the docker centos image by command docker pull centos

Image pulled

STEP 5:-

Launch the Docker Container from the centos image by command docker run -it centos:latest

Container Launched

🔰NOTE :- yon can give container name anything that u want and root@eacd2ba40792 this is the terminal of docker container.

STEP 6:-

Install the python in docker container by command yum install python3 -y

Installing Python
Python Installed

STEP 7:-

Install pandas Library inside docker container by command pip3 install pandas

Pandas Library Installed

STEP 8:-

Install scikit-learn Library inside docker container by command pip3 install scikit-learn

Scikit-learn Library Installed

STEP 9:-

copy the dataset file from bash redhat system to docker container by command docker cp “filename” “containername:/”

In my case file name is SalaryData.csv and container name is MLmodel

In my case command is docker cp SalaryData.csv MLmodel:/

Coping dataset into Container

🔰Note :- Run docker cp command from bash os that is redhat linux.

STEP 10:-

Create a python file by command touch ML.py

File created

STEP 11:-

Open the file by command vi ML.py

File opened

🔰Note :- After opened the just press i for insert mode.

STEP 12:-

Write Machine Learning code in ML.py file that is given below in Image or you can download code from my github repo(link given below)

ML Content in file

🔰Note :- For closing the file press Escape key then :wq

STEP 13:-

Run python file(ML.py) for Prediction by command python3 ML.py

File Run Successfully

Now, You can see file run successfully and it gives output(salary) on the basis of past experience.

Your Machine Learning Model is Ready

If you liked the above blog , please Clap and Share it.

DM me on LinkedIN in case of any Suggestions/queries/feedback.

Github URL:-

LinkedIN Link :-

ThankYou🙏🙏

--

--