How to load a Machine Learning model in Docker

Docker is a software platform for building applications based on containers — small and lightweight execution environments that make shared use of the operating system kernel but otherwise run in isolation from one another. While containers as a concept have been around for some time, Docker, an open source project launched in 2013, helped popularize the technology, and has helped drive the trend towards containerization and microservices in software development that has come to be known as cloud native development.

We will be performing below mentioned steps to load a machine learning model on Docker:

4. Install the required Python packages on the top of docker container.

5. Now inside this container we need to copy/create our machine learning model on whichever dataset we want.

6. Create model file.

7. Run your model.

Step 1: Pull the Centos Image from Dockerhub.

“docker pull centos:latest”

Step 2 : Create container with the help of centos image.

“docker run -i -t — name=container_name centos:latest”

Step 3 : Install the Python software on the top of docker container.

“yum install python3”

Step 4: Install the required Python packages on the top of docker container.

“pip3 install numpy”

“pip3 install pandas”

“pip3 install scikit-learn”

Step 5 : Now inside this container we need to copy/create our machine learning model on whichever dataset we want.

“ docker cp salary_data.csv ml:/salary_data.csv”

Step 6 : Create a predict.py file.

Step 7 : Run the model.

THANK YOU!

--

--

--

nerd with words.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Update Assets without creating a new build

Nested Scrolling ListView inside PageView in Flutter

SQL VS NoSQL: Top 10 Head-to-Head Comparisons

SQL vs No SQL

Kava-5 Launch Post-Mortem

Flask — Quick Start

An Interesting Challenge with SwiftUI

Property Finder Tech Profiles: Giri Patil, VP Engineering

How I Learn New Technology

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
Aditi Awasthi

Aditi Awasthi

nerd with words.

More from Medium

Understand Kafka-Python.

Kafka Architecture

What is Apache Kafka?

Dealing with Python Packages

Log Analysis with PgBadger