Task 01 : Training & Deploying ML model in Docker Container

Jenil Sathwara
3 min readJun 1, 2021

What is Machine Learning

Machine Learning is a branch of Artificial Intelligence which is focused on building & training applications that learn from datasets, pattern in the dataset and improve their accuracy in predicting the things.

In ML the model is trained with the help of dataset (historical data) & from that pattern the model is able to predict the future values.

What is 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.

##########################################################################

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 docker container

👉 In Container you need to copy/create machine learning model which you have created in jupyter notebook

##########################################################################

Solution :

👉 Let’s Check First Docker Is Installed Properly & Running Using Following Command :

# systemctl status docker

Or Else You Can Start Docker Using This Command :

# systemctl start docker
Here You Can See There Is Already Docker Is Running In My System So No Need To Start.

👉Pull Docker Container Image of CentOS Image From DockerHub using Following Command :

# docker pull centos:latest

👉Launching The New CentOS Container Using The Following Command :

# docker run -it --name task01 centos:latest
Here Container Named Task01 Is Started

👉Installing The Python & Other Library Files Required For ML Model Using Following Commands:

yum install python3
pip3 install numpy
pip3 install sklearn
pip3 install pandas

👉You Can Check Installations By Following Command :

# pip3 list

👉Copying The Dataset File In The Container :

# docker cp Salary_Data.csv  task01:/

Run This Command In Your Base OS (Mine is RHEL8).

👉Creating The ML Model & Deploying It :

Writing The Code For The ML Model In vi editor

👉Done! Let’s Run The Code :

Task Completed!

--

--