Summer 2021 - Task 1
Hello everyone,
This time we are going to perform something interesting. Today we will be running and training a machine learning model on top of the docker container.
It’s a Simple Linear Regression Model, using the SalaryData.csv dataset. We will be predicting the salary by training the same model on the centos docker container.
Everything will be explained using screenshots of the outputs taken during the execution of the whole process.
- Downloaded the centos container image in docker

2. Launched the container using the centos image named ‘summer1'.

3. Starting and Attaching the container to get to the terminal.

4. As we can see, we don’t have python3 and pip3 installed on our container.

5. Installing python3 and pip3 using the command, ‘yum install python36’.

6. As we can see that pip3 has been installed properly and python3 is also running.

7. Now, we have to install all the necessary libraries required for our machine learning model such as pandas, NumPy, matplotlib, etc.

8. Here, to work with the datasets, first, we need to get the datasets to the docker container. We will use the command, “docker cp <SourcePath> <containerID>:<DestinationPath>”.

9. As you can see that, we have our python code ready, and after running it, that is training the model using “python3 slg.py”, we can see that our prediction based on our trained model has been shown.

10. In our code, we have also used to create a shortcut file to our trained model, so that we don’t have to re-train the model to get the desired prediction using the Joblib library. And we can verify that the prediction of our model using both the methods is same.

Thank You for reading!!!
Happy Learning!