How to run a ML model on docker?
What is Docker?
Docker is a popular open-source project written in go and developed by Dotcloud (A PaaS Company). It is basically a container engine that uses the Linux Kernel features like namespaces and control groups to create containers on top of an operating system.
What is Machine Learning?
Machine Learning is the science of getting computers to learn and act like humans do, and improve their learning over time in autonomous fashion, by feeding them data and information in the form of observations and real-world interactions.
What is Model?
A machine learning model is a file that has been trained to recognize certain types of patterns. You train a model over a set of data, providing it an algorithm that it can use to reason over and learn from those data.
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
Lets begin,
Step 1 :- Pull the Docker container image of CentOS image from DockerHub and create a new container.
- First, install the Rhel 8 using Virtualization in the System or go through this document to install :-
- Second, Configure the “YUM” inside the Rhel 8 or use below document to configure it.
- Third, install the Docker using yum or use below document for guidance.
- Fourth, Start the docker services using cmd :-
- “ systemctl start docker”
- “Systemctl status of docker”
- Pull the Docker image of “Centos : latest” from Docker.hub.com using “docker pull centos : latest”.
- Run the Docker Container using cmd “docker run -it — name [container_name] [image_name]” .
Step 2 :- Install the Python software on the top of docker container.
- Install python using using yum cmd.
- install python libraries numpy, pandas, scikit-learn usind pip3 cmd.
Step 3 :- In Container you need to copy/create machine learning model which you have created in jupyter notebook.
- Download the salary dataset in rhel8 OS or download in win if your base OS in win and copy it in Rhel 8 OS using WinSCP.
- After download , Copy that dataset into your Docker Container using Docker cp cmd .
- open new terminal and run the docker cp cmd.
- For checking purpose , dataset is copied in docker container or not open the docker container and use ls cmd in your Destination folder.
=> write the code to run a Machine Learning Code, open the vi editor to write code.
=> To Run a Model use “python3 modelname.py”.
Have Successfully , Run the ML model on Docker and Our model Predict the Salary According to the Experience of years.
!!!!THANK YOU!!!!