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
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Vinay Mann
Vinay is a highly experienced DevOps Engineer with expertise in various industry-standard tools and technologies. His skill set includes Linux administration, AWS services, Docker, Kubernetes, Ansible, Git, Jenkins, Terraform, Python, and Shell scripting. He has contributed to projects like Oodles dashboard, Communication Scaffold, and Oodles.com. Vinay has also earned certifications in AWS Solution Architect and RHCSA, demonstrating his proficiency in these domains. He plays a crucial role in ensuring the seamless functioning of software development and deployment processes.