Deploy your Own Machine Learning Model on Docker Container
What is Machine Learning?
Machine Learning is the field of study that gives computers the capability to learn without being explicitly programmed. ML is one of the most exciting technologies that one would have ever come across. As it is evident from the name, it gives the computer that makes it more similar to humans: The ability to learn. Machine learning is actively being used today, perhaps in many more places than one would expect.
What is Docker?
Docker is a set of platforms as a service product that uses 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; they can communicate with each other through well-defined channels.
1. Start Docker Services
systemctl status docker
systemctl start docker
systemctl enable docker
Now we can finally start our docker services.
2. Pull Centos Image from Docker Hub
docker image pull centos:latest
3. Run a Docker Container with this Image
docker run -it --name modelDeploy centos:latest
4. Now install python3, pandas, NumPy, sklearn, and joblib
yum install python3
pip3 install pandas
pip3 install Numpy
pip3 install sklearn
pip3 install joblib
5. Now Copy the model that you have export using joblib
docker cp /root/salary.pk1 modelDeploy:/model/
6. Now we load this model by withing code below:
vim model.py
7. Now run the Code
Finally, we deploy our model inside the docker.