Integration of ML with Docker

Integration of ML with Docker

So, here are some steps for the deployment of ML model on Docker:-

Step 1:- Pulling CentOS image from DockerHub

docker pull <image_name>
No alt text provided for this image

Step 2:- Launching new Container

docker run -it --name <container_name> <image_name>
No alt text provided for this image

Step 3:- Installing Python in newly launched Container

yum install python3
No alt text provided for this image

Step 4:- Copying ML code in Container from BaseOS

Here, the model is trained and stored in score.pk1 file and in score.py file, it is loaded to find the prediction value. So, both the files are being copied in the container.

docker cp <src_file> <container_name>:<dest_path>
No alt text provided for this image

Step 5:- Installing required Python Libraries

Before we run the model, we have to install the scikit-learn(provides sklearn module) and joblib(provides joblib module) library. sklearn module is used for training the model and the joblib module is to load the model(score.pk1) in our code.

pip3 install <lib_name>
No alt text provided for this image

Step 6:- Running program

python3 <py_file>
No alt text provided for this image


Thank You
Hope you find it helpful...

To view or add a comment, sign in

More articles by Kalyani Verma

Explore content categories