Salary Predictor Model using machine learning on Docker

Mohammed Adnan
3 min readMay 27, 2021

Summer Program 2021 #Task1

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 the docker container.
  • In Container, you need to copy/create a machine learning model which you have created in jupyter notebook.

step 1:We have collected Data and formed a dataset.

Step 2: Prepare an ML model of linear regression on Jupyter NoteBook

Step 3: Check if the Docker is available

We use the command: docker info

Step 4: Download CentOS latest version image from Docker Hub

We use the command: docker pull centos:latest

Step 5: Create a Container with the help of CentOS image

We use the command: docker run -i -t — name=<name> centos:latest

Step 6: Download Python in the Container

We use the command: yum install python3

Step 7: Install the necessary libraries for the Python

pip3 install NumPy

pip3 install pandas

pip3 install scikit-learn

Step 8: Copy the ML Model from the host to the container

Copy the model and .csv file from the host machine to the guest machine

We use the command:

docker cp <model_name> <container_name>:/<model_name>

Step 9: Create a Model file in the Container

Open a vi editor and make a file with .py extension.

Step 10: Run the model on python

To run the code for test we use the command: python3 model.py

Thank you!

--

--