Machine Learning Model On Docker Container Using Centos Image

Rishabh Jain
3 min readMay 27, 2021

What is docker ?

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.

What is Machine Learning ?

Machine learning is a branch of artificial intelligence that includes methods, or algorithms, for automatically creating models from data. Unlike a system that performs a task by following explicit rules, a machine learning system learns from experience. Whereas a rule-based system will perform a task the same way every time (for better or worse), the performance of a machine learning system can be improved through training, by exposing the algorithm to more data.

Task 01 👨🏻‍💻

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
👉 Create a blog/article/video step by step you have done in completing this task.
👉 Submit the link of blog/article or vid

Firstly you have docker installed in your system.

To check it is available or not and to get information about it use command.

To use docker first we have to start docker services. And make it enable so it will be on start mode permanently.

Steps to follow:

1. Pull Centos Image.

2. Create a container with the downloaded image.

Launch docker container

3. Install Python Interpreter.

4. Install All The Dependencies.

Install pandas library now using pip3.
Install numpy library using pip3.
Install scikit-learn library using pip3.
Install joblib library using pip3.

5. Created folder in this container.

Created folder SummerTrainingLW
Inside SummerTrainingLW, created another folder ML

6. Create dataset to train our model.

vi opens an editor so we write the content inside editor.
Dataset marks.csv in the model for prediction

7. Train our model using python code in model.py

We created python file model.py where we write code to train our model for prediction.

8. Run above code using command python3 model.py

Running this code your model will be trained
Predicted model is saved with model.pk1

9. Check prediction with our created model code.

Prediction from our saved model.

Task Done Successfully!!!!

Thanks, for reading…

--

--