MACHINE LEARNING ON DOCKER CONTAINER

Manav Misra
3 min readMay 26, 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 copy the python file from host to docker container.

👉 Install required libraries required to load ML model

👉 Run the python code for prediction.

What is Machine Learning?

Machine Learning is the science of getting computers to learn and act like humans do, and improve their learning over time in autonomous fashion, by feeding them data and information in the form of observations and real-world interactions.

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.

Lets start with the task:

STEP 1

Installing Docker on RHEL8

Install docker using “yum install docker-ce”

Checking status of docker whether it is running or not

“systemctl status docker” command shows the status of docker

👉 Pull the Docker container image of CentOS image from DockerHub and create a new container

“docker pull centos:latest” is used for pulling image

“docker run -it __name CONTAINERNAME centos:latest” for launching container.

STEP 2

👉 Install the Python software on the top of docker container

python can be installed using “yum install python3” command

STEP 3

👉 Copying the Machine Learning Model from local host to docker container.

“docker cp <src> <container_name>:<dest>” is used for copying from local host to container.

Step 4 :-

Install required libraries required to load ML model :-

All required libraries can be installed from the following command:

pip3 install <name of library>

Step 5 :-

Running python code for prediction.

Python Code

OUTPUT

That’s all for this blog, hope you liked it.

You can also follow me on my Linkedin profile by clicking on following link.

--

--