Using Docker with python and Machine Learning

Posted By : Vinay Mann | 24-Jun-2022

To Use Docker for ML programs
 

The Agenda of this block is to provide a stable environment for ML algorithms to get 

executed on the docker engine with stable and accurate results.

 

Before starting this firstly we have to know about the basics that what is docker, what is

ML and how are we going to configure them to get the desired result.

DOCKER :

 

Docker is an open-source containerization platform. It provides features to the developers to deploy their applications into containers. Containers are just like an empty

vessel with the minimum configuration to run an application. Using containers we can deploy an application with ease and at a fast pace.

 

Machine Learning: 

 

It is a set of algorithms that we use to generate results based on previous data and their pattern. It is a crucial component of the growing field of data science and artificial intelligence. With the use of statistical methods, algorithms are trained to make classifications or predictions of data and also help in finding key insights along with data mining projects

 

Step 1: First we need to install docker in our environment using the package manager.

Command: yum install docker-ce – nobest

 

This command will install the docker in your system and after that, we have to check the status to make sure that the service is active and running

Command: systemctl start docker

                    systemctl status docker

 

Step 2: Now we need to pull the centos image 

Command: docker pull centos

 

Step 3: Now we will launch a container using the centos image and then we will install all the packages which we need.

 


 

Now we install the python libraries needed for it.

 

Step 5: Install python libraries

"pip3 install numpy"

"pip3 install pandas"

"pip3 install sklearn"

 

Step 6: Now we just need to move our code from the local machine to our container

Command: “docker cp <src> <container_name>:<dest>”

 

Final Step: Execute the python prediction program

Final Output


 

About Author

Author Image
Vinay Mann

Vinay is focused and career oriented and he is very keen about the new technologies. He is team player and open to new challenges and he also loves to travel.

Request for Proposal

Name is required

Comment is required

Sending message..