MACHINE LEARNING MODEL ON DOCKER CONTAINER

Abhay desai
3 min readMay 27, 2021

Task Description

Create and run Machine Learning Model on a Docker container

#you should may have docker configured in BaseOS

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

# docker pull centos:latest version(8)

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

Installing Python in docker container.

Step 4: Install numpy , pandas, and sklearn python libraries

#pip3 install numpy

Installing numpy in container

#pip3 install pandas

Installing pandas in container

#pip3 install sklearn

Instaling sklearn in container

Step 5: Created a Directory for the Project

Step 6 : Copy dataset from base os to Docker container

Step 7 : Create a python file model.py 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 , Which will create our model .

Step 8 : Create a python file (train_model.py)that will predict an employee’s salary using the above trained model.

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

And our model is Working ..!!

Hope It will help you..!!

--

--