Executing ML model inside Docker

Executing ML model inside Docker

Hello everyone😊

This is the article on "Executing ML model inside docker." I have used Redhat Linux as a docker host and CentOS as a container.

==========================================================

Model: Salary predictor on years of experience

Task_1 Description:

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

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

👉 In Container you need to copy/create a machine learning model which you have created in Jupyter notebook

==========================================================

1. Install docker in your base system.

Commands to install docker

No alt text provided for this image

Now check if docker is successfully installed in your system

No alt text provided for this image

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

No alt text provided for this image

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

  • run docker by creating a container and install python3.

docker run -i -t --name=container_name centos:latest

No alt text provided for this image
  • install the libraries required for the model i.e., pandas, numpy, and scikit-learn.
No alt text provided for this image
No alt text provided for this image

4. In Container you need to copy/create a machine learning model which you have created in Jupyter notebook.

Copy your ML model inside the docker by using the command:

docker cp file_name container_name:/file_name

No alt text provided for this image
  • Create a file and write the code to import your model and inserting the data for which you need the prediction.
No alt text provided for this image
  • Run the code in Python3.
No alt text provided for this image

==========================================================

Thank you all for giving it a read.
😊

To view or add a comment, sign in

More articles by Mukul Pramanik

  • K-means Clustering and its use case in the security domain

    Nowadays, the network has become the basis of everything. Meanwhile, network security has become one of today's most…

    1 Comment
  • Web Application for Docker

    Task Description 📄 This app will help the user to run all the docker commands like: 👉docker images👉docker ps…

    6 Comments
  • Javascript use cases

    Netflix Over time, Netflix moved away from its more traditional structure into the cloud and started to introduce…

  • Local Server Video Chat Program

    This is an exciting team task in which we need to write a code for video streaming but without audio. To do so, we need…

    12 Comments
  • Playing with OpenCV

    OpenCV (Open Source Computer Vision Library) is an open-source library of programming functions mainly aimed at…

    10 Comments
  • Confusion matrix & Cybersecurity

    ___________________________________________________________ What is a Confusion Matrix? A Confusion matrix is an N x N…

    3 Comments
  • GUI application inside Docker

    Hello everyone🤗 This is the article on how to launch a GUI application inside Docker. I have used Redhat Linux as a…

    10 Comments

Explore content categories