Ishika Mandloi

May 27, 2021

2 min read

Simple Machine Learning model on Docker container

Task description

Create and run a machine learning model on a Docker container.

The prerequisite of the task is :

Docker configured in BaseOS

Step 1: Pull a centos docker image from the docker hub

# docker pull centos:latest

Step 2: Create a docker container with centos image

#docker run -it — name=<name_of_container> <image>:<version>

Step 3: Install python in Docker container using command

#yum install python3

Step 4: Install NumPy , pandas, and scikit-learn python libraries

#pip3 install pandas

#pip3 install scikit-learn

Step 5: Copy dataset from base os to Docker container

Step 6: Create a python file to create a model that will predict the salary of employee based on years of experience. Save the model using joblib.

Run the above python file.

Step 7: Create a python file that will use the above-created model to predict the salary according to years of experience entered.

Run the file, enter the years of experience and that will predict the salary of employee.

Here task completes successfully.