Salary Prediction inside Container

Srasthy Chaudhary
3 min readMay 31, 2021

--

Agenda:

Install docker

Run Docker container with centos image

Install python software on docker container

Create Salary Prediction App on docker container.

Docker

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and deploy it as one package.

#yum install docker -y

This command is used to install docker.

Install Docker

Now, we have to start and enable the docker services permanently.

#systemctl start docker

#systemctl enable docker

we can also check the status of the docker container by the following command:

#systemctl status docker

How to run docker container by centos image?

docker run container with centos image and name of container is Task.

#docker run -it — name Task centos:latest

How to run the same container again?

We can start the docker container and then we can attach it.

#docker start Task

#docker attach Task

Now, we have to install python software in our container.

#yum install python3

To make our Salary predictor model we have to install some libraries like pandas and scikit-learn

#pip3 install pandas

#pip3 install scikit-learn

Now we have to copy our dataset from the base OS to the docker container.

#docker cp /home/ec2-user/SalaryData.csv Task:/task1

Prepare Salary Predictor Model

#vi SalaryPredictor.py

Run this code:

#python3 SalaryPredictorModel.py

Finally, the code of predictor app is as follows:

#vi PredictorApp.py

Predictor App is ready to use.

Thank You

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response