Integration Of Docker With Machine Learning

Siri Chandana
4 min readJun 24, 2021

--

Task 01 πŸ‘¨πŸ»β€πŸ’»
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

In this Article we will discuss about deploying simple machine learning model inside Docker container

Before we going to discuss about our task first we need to know about what is docker and machine learning .

What is Docker ?

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications.

Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host. Containers are lightweight and contain everything needed to run the application, so you do not need to rely on what is currently installed on the host. You can easily share containers while you work, and be sure that everyone you share with gets the same container that works in the same way.

What is Machine learning ?

Machine learning is an application of artificial intelligence (AI) that provides systems the ability to automatically learn and improve from experience without being explicitly programmed. Machine learning focuses on the development of computer programs that can access data and use it to learn for themselves.

The process of learning begins with observations or data, such as examples, direct experience, or instruction, in order to look for patterns in data and make better decisions in the future based on the examples that we provide. The primary aim is to allow the computers learn automatically without human intervention or assistance and adjust actions accordingly.

prerequisites of task:

we need to have docker software in our virtual machine.

Lets start our task now

πŸ‘‰ Pull the Docker container image of CentOS image from DockerHub and create a new container

Step 1:

First start the docker services

systemctl start docker

Step 2:

pulling the centos image from docker hub

pull the image using docker pull centos command.

docker pull centos

Step 3:

Launching a Docker Container using the centos image

By using docker run -it --name siri centos command we have launched docker container with centos image and container name as siri.

docker run -it --name <name of contaner> <name of image>

πŸ‘‰ Install the Python software on the top of docker container

Step 1: install the python software using yum install python3 -y command.

Step 2:

Installing the necessary libraries (numpy, pandas, scikit-learn) using pip3
pip3 install numpy

pip3 install pandas

pip3 install scikit-learn

Step 3:

Copying the dataset into the container

πŸ‘‰ In Container you need to copy/create machine learning model which you have created in jupyter notebook

write the machine learning code

Now we are set to run the machine learning model.

As we can see when we enter the number of years of experience the ML model is giving the expected salary.

We have successfully deployed the ML model inside Docker Container.

--

--

No responses yet