Machine Learning Model inside Docker Container

Task Description:

  • Pull an image and launch an container.
  • Install python inside docker container.
  • copy/create a machine learning model.

Step 1: Check docker information.

  • USING COMMAND “ docker info”.

STEP 2: PULL CENTOS IMAGE AND CREATE A NEW CONTAINER.

USING COMMAND “ docker pull centos”.

STEP 3: RENAME CONTAINER AND INSTALL PYTHON3

USING COMMAND “ docker run -it — name <name of container> centos:latest

FOR DOWNLOADING PYTHON 3 USE: “ yum install python3”.

STEP 4: INSTALL LIBRARIES

  • “pip3 install pandas”
  • “pip3 install numpy”
  • pip3 install scikit-learn

STEP4: COPY THE “SalaryData.csv” FILE FROM BASE OS TO CONTAINER

  • USING “ docker cp SalaryData.csv container_name:/”

STEP 5: NOW CREATE A “vi.salarypredictor.py FILE

STEP5: NOW MODEL WILL GIVE PREDICTIONS

USING “ python3 Salarypredictor.py” our model will give predictions.

THANK YOU.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store