Deploying Machine Learning Model on top of Docker Container

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 you need to copy/create machine learning model which you have created in jupyter notebook.


First of all, you should have Docker installed in your OS. In my case, I am using RHEL version 8. After installing Docker, start its service using command->

systemctl start docker

Now, we have to pull or we can say install CentOS Image in our RHEL8 BaseOS. For doing this, use command->

docker pull centos:latest

Here, I am downloading the latest version of CentOS and “pull” command by default downloads from public repository of Docker which contains all types of simple and customized images called as “Docker Hub”.

To check whether image is installed or not, we can use command->

docker images


After downloading CentOS image, we have to launch one container from CentOS image using command->

docker run -it --name= <cont_name> centos:latest

Now, we will install Python interpreter on top of docker container using command->

yum install python36 -y


Now, I have already transferred model I bulit on my Jupyter Notebook in my RHEL8 OS. You can refer video for the code. To copy this model (.pk1) file in docker container, use command->

docker cp <model> <cont_name>:<destination>

If we want to load this package in our container, we have to install joblib library and in order to load and execute the code we have written we have to install another library called scikit_learn.

pip3 install joblib

pip3 install scikit_learn

Now, we will write code in python which will load this file and then predict the output for us. Refer below video.

Thank You Vimal Daga Sir for giving such a wonderful task from which we learned a lot.




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Show your XRPL validator domain

Learning Golang with HackerRank — #6 Mini-Max Sum

Octo’s Guide to the Git-Verse

How to choose a BIM collaborative App?

How to Declutter a Cluttered File System

COVID Impact: Microserver Market is projected to reach a value of over USD 71 billion by 2027 at a…

Seamless Collaboration on Planhat


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aditya Pande

Aditya Pande

More from Medium

What is deep learning exactly? | HData Systems

Anyscale — Considerations for deploying machine learning models in production: Part 2

A Simple Machine Learning step by step tutorial: Using Amazon Translate + Lambda + API Gateway &…

Image Watermarking Using Computer Vision