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>
Step 2:- Launching new Container
docker run -it --name <container_name> <image_name>
Step 3:- Installing Python in newly launched Container
yum install python3
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>
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>
Step 6:- Running program
python3 <py_file>
Thank You
Hope you find it helpful...
Great work