Machine Learning model in Docker container with Python..

Sourabh Mishra
2 min readMay 27, 2021

Follow the steps to deploy machine learning model on Docker Container……

Step 1. Run the docker container

# docker run -it centos:latest

Step 2. Install the Python Interpreter and python modules ..

[Note — yum is pre configured in centos container]

# yum install python3 -y

Now we will install the python modules needed for the model

# pip3 install scikit-learn -y

#pip3 install numpy -y

# pip3 install pandas -y

Now we will copy the Salary_Data.csv from the base RedHat OS.

# docker cp Salary_Data.csv [container id]:/root

check if your docker container is running

# docker ps

If your docker container is stopped then

# docker start[container id]

# docker attach [container id]

Now, since we have already install the python interpreter and python modules in our docker container, So we are good to go with the Machine Learning Programing.

Note You can find the code in my GitHub Repository link provided below

link — https://github.com/code-sourabh/Machine-Learning-Docker-container-Python.git

Now run the python file

# python3 salary data ml model.py

--

--