Integrate Machine Learning Model with Docker Container

Integrate Machine Learning Model with Docker Container

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 the docker host.

👉 Install the Required python libraries to required to load ML Model.

👉 Run the python code for the prediction.

What is Docker ?

No alt text provided for this image

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files.

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

Step 1.

“docker pull” is a one command in the docker to download the docker image from the internet or docker registry.

“docker pull centos:latest”

No alt text provided for this image

docker run is a command in docker to launch the container

“docker run -it — name newos centos:latest”

No alt text provided for this image

👉 Install the Python software on the top of docker container.

Step 2

👉 Install the Python and Git software on the top of docker container.

  • To install python-3.8 and latest git, use command:

"yum install python38 git"

No alt text provided for this image

👉 Cloning the Git Repository

Step 3

Cloning the Git Repository

  • Go to the GitHub repository where your machine learning model, as well as the required files, are present.
  • Use command "git clone <Repo_URL>" to clone the Github repository.
No alt text provided for this image

👉 Install the Required python libraries to required to load ML Model.

Step 4

Install the Python libraries

  • Python Libraries are a set of useful functions that eliminate the need for writing codes from scratch. Python libraries play a vital role in developing machine learning, data science, data visualization, image and data manipulation applications, and more.
No alt text provided for this image

👉 Run the python code for the prediction.



Step 5

Execute the program

  • We are going to execute the program using a Python3 Interpreter.
No alt text provided for this image

 Check the output/result

  • After execution, it looks like this.
  • Finally to stop the container use the following command: "docker stop newos"


Written By: @IMRAN KHAN

Thank You

To view or add a comment, sign in

More articles by Imran Khan

  • Confusion Matrix role in Cyber Security

    What is Cyber Security? Cyber security refers to the body of technologies, processes, and practices designed to protect…

  • Running GUI Applications in Docker Container

    Task 02 👨🏻💻 Task Description 📄 📌 GUI container on the Docker 🔅 Launch a container on docker in GUI mode 🔅 Run…

    1 Comment

Others also viewed

Explore content categories